From 29d23f4d9df914c7d695b8924a6e80039f32eebc Mon Sep 17 00:00:00 2001 From: Isc Date: Mon, 11 May 2020 14:40:17 +0800 Subject: [PATCH] Remove random --- .../SearchableBaseNoteFragmentTest.java | 70 +++++++++---------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/app/src/test/java/it/niedermann/owncloud/notes/android/fragment/SearchableBaseNoteFragmentTest.java b/app/src/test/java/it/niedermann/owncloud/notes/android/fragment/SearchableBaseNoteFragmentTest.java index 68912d03..7b61a671 100644 --- a/app/src/test/java/it/niedermann/owncloud/notes/android/fragment/SearchableBaseNoteFragmentTest.java +++ b/app/src/test/java/it/niedermann/owncloud/notes/android/fragment/SearchableBaseNoteFragmentTest.java @@ -45,41 +45,41 @@ public class SearchableBaseNoteFragmentTest { } } - @Test - public void testCountOccurrencesRandom() { - try { - Method method = SearchableBaseNoteFragment.class.getDeclaredMethod("countOccurrences", String.class, String.class); - method.setAccessible(true); - - for (int count = 10; count <= 15; ++count) { - StringBuilder sb = new StringBuilder("Mike Chester Wang"); - Random rand = new Random(); - for (int i = 0; i < count * 100; ++i) { - sb.append(rand.nextDouble()); - if (i % 100 == 0) { - sb.append("flag"); - } - } - - long startTime = System.currentTimeMillis(); - int num = (int) method.invoke(null, sb.toString(), String.valueOf(rand.nextInt(100))); - long endTime = System.currentTimeMillis(); - System.out.println("Random Version"); - System.out.println("Total Time: " + (endTime - startTime) + " ms"); - System.out.println("Total Times: " + num); - System.out.println("String Size: " + (sb.length() / 1024) + " K"); - System.out.println(); - - if (endTime - startTime > 10) { - fail("The algorithm spends too much time."); - } - } - - } catch (Exception e) { - fail(Arrays.toString(e.getStackTrace())); - Log.e("Test Count Occurrences Random", Arrays.toString(e.getStackTrace())); - } - } +// @Test +// public void testCountOccurrencesRandom() { +// try { +// Method method = SearchableBaseNoteFragment.class.getDeclaredMethod("countOccurrences", String.class, String.class); +// method.setAccessible(true); +// +// for (int count = 10; count <= 15; ++count) { +// StringBuilder sb = new StringBuilder("Mike Chester Wang"); +// Random rand = new Random(); +// for (int i = 0; i < count * 100; ++i) { +// sb.append(rand.nextDouble()); +// if (i % 100 == 0) { +// sb.append("flag"); +// } +// } +// +// long startTime = System.currentTimeMillis(); +// int num = (int) method.invoke(null, sb.toString(), String.valueOf(rand.nextInt(100))); +// long endTime = System.currentTimeMillis(); +// System.out.println("Random Version"); +// System.out.println("Total Time: " + (endTime - startTime) + " ms"); +// System.out.println("Total Times: " + num); +// System.out.println("String Size: " + (sb.length() / 1024) + " K"); +// System.out.println(); +// +// if (endTime - startTime > 10) { +// fail("The algorithm spends too much time."); +// } +// } +// +// } catch (Exception e) { +// fail(Arrays.toString(e.getStackTrace())); +// Log.e("Test Count Occurrences Random", Arrays.toString(e.getStackTrace())); +// } +// } @Test public void testNullOrEmptyInput() {