diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d83ef1e16ca8515c61d6ffcd22d4cbca30321fbd --- /dev/null +++ b/tests/README.md @@ -0,0 +1,2 @@ +To test your code on other inputs, replace the P.input file with another file. We have provided +three examples for you which we will use to test your code. diff --git a/tests/hashcode.input b/tests/hashcode.input new file mode 100644 index 0000000000000000000000000000000000000000..9cdbd017818d209e6fcc9bb0b07eb9eced5921c9 --- /dev/null +++ b/tests/hashcode.input @@ -0,0 +1,3 @@ +public static void P(String input) { + System.out.print(input.hashCode()); +} diff --git a/tests/identity.input b/tests/identity.input new file mode 100644 index 0000000000000000000000000000000000000000..b75fad8375906d5afd8627422b237b9d61e1cb8b --- /dev/null +++ b/tests/identity.input @@ -0,0 +1,3 @@ +public static void P(String input) { + System.out.print(input); +} diff --git a/tests/sort.input b/tests/sort.input new file mode 100644 index 0000000000000000000000000000000000000000..0c065b2047404ce897f05e20ba969e0574cdcba7 --- /dev/null +++ b/tests/sort.input @@ -0,0 +1,20 @@ + public static void P(String input) { + /* Stupid Bubble Sort! */ + char[] array = input.toCharArray(); + boolean swapped = true; + int j = 0; + char tmp; + while (swapped) { + swapped = false; + j++; + for (int i = 0; i < array.length - j; i++) { + if (array[i] > array[i + 1]) { + tmp = array[i]; + array[i] = array[i + 1]; + array[i + 1] = tmp; + swapped = true; + } + } + } + System.out.println(new String(array)); + }