From d784819b4515bf4b16b598b619d72c349d16d481 Mon Sep 17 00:00:00 2001 From: Oszkar Semerath Date: Mon, 26 Jul 2021 18:44:34 +0200 Subject: Small renaming and refactoring --- .../solver/data/map/test/smoke/fast/SmokeTest1Mutable.java | 2 +- .../solver/data/map/test/smoke/fast/SmokeTest2Commit.java | 2 +- .../map/test/smoke/fast/SmokeTest3MutableImmutableCompare.java | 6 +++--- .../solver/data/map/test/smoke/fast/SmokeTest4Restore.java | 8 ++++---- .../solver/data/map/test/support/MapTestEnvironment.java | 10 +++++++++- 5 files changed, 18 insertions(+), 10 deletions(-) (limited to 'Solvers/VIATRA-Solver') 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 { exception.printStackTrace(); fail(scenario+":"+index+": exception happened: "+exception); } - if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" finished"); + MapTestEnvironment.printStatus(scenario, index, steps, null); } } 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 { exception.printStackTrace(); fail(scenario+":"+index+": exception happened: "+exception); } - if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" finished"); + MapTestEnvironment.printStatus(scenario, index, steps, null); if(index%commitFrequency == 0) { e.sut.commit(); //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 { Random r = new Random(seed); - iterativeRandomPutsAndCommits(scenario,immutable,mutable, steps, maxKey, values, r, commitFrequency); + iterativeRandomPutsAndCommitsAndCompare(scenario,immutable,mutable, steps, maxKey, values, r, commitFrequency); } - void iterativeRandomPutsAndCommits( + void iterativeRandomPutsAndCommitsAndCompare( String scenario, VersionedMapImpl immutable, VersionedMapImpl mutable, @@ -56,7 +56,7 @@ public class SmokeTest3MutableImmutableCompare { } MapTestEnvironment.compareTwoMaps(scenario+":"+index,immutable, mutable); - if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" finished"); + MapTestEnvironment.printStatus(scenario, index, steps, null); } } 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 { - iterativeRandomPutsAndCommits(scenario,store, steps, maxKey, values, seed, commitFrequency); + iterativeRandomPutsAndCommitsThenRestore(scenario,store, steps, maxKey, values, seed, commitFrequency); } - void iterativeRandomPutsAndCommits( + void iterativeRandomPutsAndCommitsThenRestore( String scenario, VersionedMapStore store, int steps, @@ -58,7 +58,7 @@ public class SmokeTest4Restore { long version = versioned.commit(); index2Version.put(i,version); } - if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" building finished"); + MapTestEnvironment.printStatus(scenario, index, steps, "building"); } // 2. create a non-versioned and VersionedMapImpl reference = (VersionedMapImpl) store.createMap(); @@ -78,7 +78,7 @@ public class SmokeTest4Restore { versioned.restore(index2Version.get(i)); MapTestEnvironment.compareTwoMaps(scenario+":"+index,reference, versioned); } - if(index%10000==0) System.out.println(scenario+":"+index+"/"+steps+" comparison finished"); + MapTestEnvironment.printStatus(scenario, index, steps, "comparison"); } 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 { @Override public int getHash(Integer key, int index) { - if(evil && index < 100 && index < key/3) { + if(evil && index < 15 && index < key/3) { return 7; } int result = 1; @@ -45,6 +45,14 @@ public class MapTestEnvironment { return chp; } + public static void printStatus(String scenario, int actual, int max, String stepName) { + if(actual%10000==0) { + String printStepName = stepName==null?"":stepName; + System.out.format(scenario+":%d/%d (%d%%) "+printStepName+ "%n",actual,max,actual*100/max); + } + + } + public static void compareTwoMaps(String title, VersionedMapImpl map1, VersionedMapImpl map2) { //1. Comparing cursors. Cursor cursor1 = map1.getCursor(); -- cgit v1.2.3-54-g00ecf