diff --git a/lib/junit-benchmarks-0.7.0.jar b/lib/junit-benchmarks-0.7.2.jar old mode 100644 new mode 100755 similarity index 50% rename from lib/junit-benchmarks-0.7.0.jar rename to lib/junit-benchmarks-0.7.2.jar index bea0bf5..93aee13 Binary files a/lib/junit-benchmarks-0.7.0.jar and b/lib/junit-benchmarks-0.7.2.jar differ diff --git a/test/zutil/benchmark/LoopBenchmark.java b/test/zutil/benchmark/LoopBenchmark.java new file mode 100755 index 0000000..8e5300b --- /dev/null +++ b/test/zutil/benchmark/LoopBenchmark.java @@ -0,0 +1,42 @@ +package zutil.benchmark; + +import com.carrotsearch.junitbenchmarks.BenchmarkRule; +import org.junit.Rule; +import org.junit.Test; +import zutil.StringUtil; + +public class LoopBenchmark { + public static final int TEST_EXECUTIONS = 500; + + @Rule + public BenchmarkRule benchmarkRun = new BenchmarkRule(); + + + private int[] matrix = new int[100_000]; + private int[] matrix2 = new int[50_000]; + + + @Test + public void oneLoop() { + for(int k=0; k splitList = new ArrayList<>(); + int from = 0, to = 0; + while (to >= 0) { + to = str.indexOf(delimiter, from + 1); + if (to < 0) + splitList.add(str.substring(from)); + else + splitList.add(str.substring(from, to)); + from = to; + } + assertSplit(splitList.toArray(new String[splitList.size()])); + } + } + + public void assertSplit(String[] str){ + assertEquals(13,str.length); + } +} diff --git a/test/zutil/parser/json/JSONSerializerBenchmark.java b/test/zutil/parser/json/JSONSerializerBenchmark.java index 42810c7..61845f4 100755 --- a/test/zutil/parser/json/JSONSerializerBenchmark.java +++ b/test/zutil/parser/json/JSONSerializerBenchmark.java @@ -57,7 +57,7 @@ public class JSONSerializerBenchmark { TestClass targetObj = (TestClass) in.readObject(); in.close(); - assertEquals( sourceObj, targetObj ); + TestClass.assertEquals( sourceObj, targetObj ); } } @@ -68,7 +68,7 @@ public class JSONSerializerBenchmark { TestClass targetObj = JSONSerializerTest.sendReceiveObject(sourceObj); - assertEquals( sourceObj, targetObj ); + TestClass.assertEquals( sourceObj, targetObj ); } } diff --git a/test/zutil/parser/json/JSONSerializerTest.java b/test/zutil/parser/json/JSONSerializerTest.java index 88a75f4..408fe8b 100755 --- a/test/zutil/parser/json/JSONSerializerTest.java +++ b/test/zutil/parser/json/JSONSerializerTest.java @@ -186,8 +186,6 @@ public class JSONSerializerTest{ out.close(); String data = bout.toString(); - System.out.println(data); - return data; }