Merge pull request #481 from afischerdev/update-test
Add test profiles with lookups.dat
This commit is contained in:
commit
fce160e89d
3 changed files with 84 additions and 0 deletions
|
@ -0,0 +1,50 @@
|
|||
package btools.expressions;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class IntegrityCheckProfile {
|
||||
|
||||
public static void main( final java.lang.String[] args ) {
|
||||
if (args.length != 2) {
|
||||
System.out.println("usage: java IntegrityCheckProfile <lookup-file> <profile-folder>");
|
||||
return;
|
||||
}
|
||||
|
||||
IntegrityCheckProfile test = new IntegrityCheckProfile();
|
||||
try {
|
||||
File lookupFile = new File(args[0]);
|
||||
File profileDir = new File(args[1]);
|
||||
test.integrityTestProfiles(lookupFile, profileDir);
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void integrityTestProfiles(File lookupFile, File profileDir) throws IOException, Exception {
|
||||
File[] files = profileDir.listFiles();
|
||||
|
||||
if (files==null) {
|
||||
System.err.println("no files " + profileDir);
|
||||
return;
|
||||
}
|
||||
if (!lookupFile.exists()) {
|
||||
System.err.println("no lookup file " + lookupFile);
|
||||
return;
|
||||
}
|
||||
|
||||
for (File f : files) {
|
||||
if (f.getName().endsWith(".brf")) {
|
||||
BExpressionMetaData meta = new BExpressionMetaData();
|
||||
BExpressionContext expctxWay = new BExpressionContextWay(meta);
|
||||
BExpressionContext expctxNode = new BExpressionContextNode(meta);
|
||||
meta.readMetaData(lookupFile);
|
||||
expctxNode.setForeignContext(expctxWay);
|
||||
expctxWay.parseFile(f, "global");
|
||||
expctxNode.parseFile(f, "global");
|
||||
System.out.println("test " + meta.lookupVersion + "."+meta.lookupMinorVersion + " " + f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package btools.expressions;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class IntegrityCheckProfileTest {
|
||||
|
||||
@Test
|
||||
public void integrityTestProfiles() throws IOException {
|
||||
File workingDir = new File(".").getCanonicalFile();
|
||||
File profileDir = new File(workingDir, "../misc/profiles2");
|
||||
File[] files = profileDir.listFiles();
|
||||
|
||||
assertNotNull("Missing profiles", files);
|
||||
|
||||
for (File f : files) {
|
||||
if (f.getName().endsWith(".brf")) {
|
||||
BExpressionMetaData meta = new BExpressionMetaData();
|
||||
BExpressionContext expctxWay = new BExpressionContextWay(meta);
|
||||
BExpressionContext expctxNode = new BExpressionContextNode(meta);
|
||||
meta.readMetaData(new File( profileDir, "lookups.dat"));
|
||||
expctxNode.setForeignContext(expctxWay);
|
||||
expctxWay.parseFile(f, "global");
|
||||
expctxNode.parseFile(f, "global");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,3 +20,4 @@ assign costfactor
|
|||
|
||||
---context:node # following code refers to node tags
|
||||
|
||||
assign initialcost = 0
|
||||
|
|
Loading…
Reference in a new issue