diff options
Diffstat (limited to 'Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data')
5 files changed, 18 insertions, 10 deletions
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest1Mutable.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest1Mutable.java index a1d37241..3011f0a0 100644 --- a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest1Mutable.java +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest1Mutable.java | |||
@@ -60,7 +60,7 @@ public class SmokeTest1Mutable { | |||
60 | exception.printStackTrace(); | 60 | exception.printStackTrace(); |
61 | fail(scenario+":"+index+": exception happened: "+exception); | 61 | fail(scenario+":"+index+": exception happened: "+exception); |
62 | } | 62 | } |
63 | if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" finished"); | 63 | MapTestEnvironment.printStatus(scenario, index, steps, null); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest2Commit.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest2Commit.java index 18cb9f58..d4876557 100644 --- a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest2Commit.java +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest2Commit.java | |||
@@ -60,7 +60,7 @@ public class SmokeTest2Commit { | |||
60 | exception.printStackTrace(); | 60 | exception.printStackTrace(); |
61 | fail(scenario+":"+index+": exception happened: "+exception); | 61 | fail(scenario+":"+index+": exception happened: "+exception); |
62 | } | 62 | } |
63 | if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" finished"); | 63 | MapTestEnvironment.printStatus(scenario, index, steps, null); |
64 | if(index%commitFrequency == 0) { | 64 | if(index%commitFrequency == 0) { |
65 | e.sut.commit(); | 65 | e.sut.commit(); |
66 | //System.out.println(scenario+":"+index+": Commit! version=" + version); | 66 | //System.out.println(scenario+":"+index+": Commit! version=" + version); |
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest3MutableImmutableCompare.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest3MutableImmutableCompare.java index b8dce3f5..b78da792 100644 --- a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest3MutableImmutableCompare.java +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest3MutableImmutableCompare.java | |||
@@ -27,10 +27,10 @@ public class SmokeTest3MutableImmutableCompare { | |||
27 | 27 | ||
28 | Random r = new Random(seed); | 28 | Random r = new Random(seed); |
29 | 29 | ||
30 | iterativeRandomPutsAndCommits(scenario,immutable,mutable, steps, maxKey, values, r, commitFrequency); | 30 | iterativeRandomPutsAndCommitsAndCompare(scenario,immutable,mutable, steps, maxKey, values, r, commitFrequency); |
31 | } | 31 | } |
32 | 32 | ||
33 | void iterativeRandomPutsAndCommits( | 33 | void iterativeRandomPutsAndCommitsAndCompare( |
34 | String scenario, | 34 | String scenario, |
35 | VersionedMapImpl<Integer, String> immutable, | 35 | VersionedMapImpl<Integer, String> immutable, |
36 | VersionedMapImpl<Integer, String> mutable, | 36 | VersionedMapImpl<Integer, String> mutable, |
@@ -56,7 +56,7 @@ public class SmokeTest3MutableImmutableCompare { | |||
56 | } | 56 | } |
57 | MapTestEnvironment.compareTwoMaps(scenario+":"+index,immutable, mutable); | 57 | MapTestEnvironment.compareTwoMaps(scenario+":"+index,immutable, mutable); |
58 | 58 | ||
59 | if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" finished"); | 59 | MapTestEnvironment.printStatus(scenario, index, steps, null); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | 62 | ||
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest4Restore.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest4Restore.java index e024700a..ceea84d5 100644 --- a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest4Restore.java +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/smoke/fast/SmokeTest4Restore.java | |||
@@ -27,10 +27,10 @@ public class SmokeTest4Restore { | |||
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | iterativeRandomPutsAndCommits(scenario,store, steps, maxKey, values, seed, commitFrequency); | 30 | iterativeRandomPutsAndCommitsThenRestore(scenario,store, steps, maxKey, values, seed, commitFrequency); |
31 | } | 31 | } |
32 | 32 | ||
33 | void iterativeRandomPutsAndCommits( | 33 | void iterativeRandomPutsAndCommitsThenRestore( |
34 | String scenario, | 34 | String scenario, |
35 | VersionedMapStore<Integer, String> store, | 35 | VersionedMapStore<Integer, String> store, |
36 | int steps, | 36 | int steps, |
@@ -58,7 +58,7 @@ public class SmokeTest4Restore { | |||
58 | long version = versioned.commit(); | 58 | long version = versioned.commit(); |
59 | index2Version.put(i,version); | 59 | index2Version.put(i,version); |
60 | } | 60 | } |
61 | if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" building finished"); | 61 | MapTestEnvironment.printStatus(scenario, index, steps, "building"); |
62 | } | 62 | } |
63 | // 2. create a non-versioned and | 63 | // 2. create a non-versioned and |
64 | VersionedMapImpl<Integer, String> reference = (VersionedMapImpl<Integer, String>) store.createMap(); | 64 | VersionedMapImpl<Integer, String> reference = (VersionedMapImpl<Integer, String>) store.createMap(); |
@@ -78,7 +78,7 @@ public class SmokeTest4Restore { | |||
78 | versioned.restore(index2Version.get(i)); | 78 | versioned.restore(index2Version.get(i)); |
79 | MapTestEnvironment.compareTwoMaps(scenario+":"+index,reference, versioned); | 79 | MapTestEnvironment.compareTwoMaps(scenario+":"+index,reference, versioned); |
80 | } | 80 | } |
81 | if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" comparison finished"); | 81 | MapTestEnvironment.printStatus(scenario, index, steps, "comparison"); |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
diff --git a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/support/MapTestEnvironment.java b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/support/MapTestEnvironment.java index ba1d0cff..1ff29d68 100644 --- a/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/support/MapTestEnvironment.java +++ b/Solvers/VIATRA-Solver/org.eclipse.viatra.solver.data/tests/org/eclipse/viatra/solver/data/map/test/support/MapTestEnvironment.java | |||
@@ -30,7 +30,7 @@ public class MapTestEnvironment<KEY,VALUE> { | |||
30 | 30 | ||
31 | @Override | 31 | @Override |
32 | public int getHash(Integer key, int index) { | 32 | public int getHash(Integer key, int index) { |
33 | if(evil && index < 100 && index < key/3) { | 33 | if(evil && index < 15 && index < key/3) { |
34 | return 7; | 34 | return 7; |
35 | } | 35 | } |
36 | int result = 1; | 36 | int result = 1; |
@@ -45,6 +45,14 @@ public class MapTestEnvironment<KEY,VALUE> { | |||
45 | return chp; | 45 | return chp; |
46 | } | 46 | } |
47 | 47 | ||
48 | public static void printStatus(String scenario, int actual, int max, String stepName) { | ||
49 | if(actual%10000==0) { | ||
50 | String printStepName = stepName==null?"":stepName; | ||
51 | System.out.format(scenario+":%d/%d (%d%%) "+printStepName+ "%n",actual,max,actual*100/max); | ||
52 | } | ||
53 | |||
54 | } | ||
55 | |||
48 | public static <KEY, VALUE> void compareTwoMaps(String title, VersionedMapImpl<KEY, VALUE> map1, VersionedMapImpl<KEY, VALUE> map2) { | 56 | public static <KEY, VALUE> void compareTwoMaps(String title, VersionedMapImpl<KEY, VALUE> map1, VersionedMapImpl<KEY, VALUE> map2) { |
49 | //1. Comparing cursors. | 57 | //1. Comparing cursors. |
50 | Cursor<KEY, VALUE> cursor1 = map1.getCursor(); | 58 | Cursor<KEY, VALUE> cursor1 = map1.getCursor(); |