diff options
author | ankitjavalkar | 2015-04-23 19:32:37 +0530 |
---|---|---|
committer | ankitjavalkar | 2015-04-26 19:46:01 +0530 |
commit | 17752a69114e7dbad266337e768013920aec8c0c (patch) | |
tree | 7f88fe72bda2dfca49e0032888fb0cb01cc73d1a /testapp/java_files | |
parent | 0580f99fecc0bb495beb5706e18246834174710b (diff) | |
download | online_test-17752a69114e7dbad266337e768013920aec8c0c.tar.gz online_test-17752a69114e7dbad266337e768013920aec8c0c.tar.bz2 online_test-17752a69114e7dbad266337e768013920aec8c0c.zip |
Code Review: Code refactoring
- Add from_json classmethod
- Question language is passed directly to the code server
- Fix errors in evaluation of code
- Fix test cases
Diffstat (limited to 'testapp/java_files')
-rw-r--r-- | testapp/java_files/main_array_sum.java | 36 | ||||
-rw-r--r-- | testapp/java_files/main_fact.java | 29 | ||||
-rw-r--r-- | testapp/java_files/main_great.java | 39 | ||||
-rw-r--r-- | testapp/java_files/main_hello_name.java | 29 | ||||
-rw-r--r-- | testapp/java_files/main_lastDigit.java | 36 | ||||
-rw-r--r-- | testapp/java_files/main_moreThan30.java | 36 | ||||
-rw-r--r-- | testapp/java_files/main_palindrome.java | 29 | ||||
-rw-r--r-- | testapp/java_files/main_square.java | 32 |
8 files changed, 0 insertions, 266 deletions
diff --git a/testapp/java_files/main_array_sum.java b/testapp/java_files/main_array_sum.java deleted file mode 100644 index 5eae299..0000000 --- a/testapp/java_files/main_array_sum.java +++ /dev/null @@ -1,36 +0,0 @@ -class main_array_sum -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result); - System.exit(1); - } - } - public static void main(String arg[]) - { - int result; - Test t = new Test(); - int x[] = {0,0,0,0,0}; - result = t.array_sum(x); - System.out.println("Input submitted to the function: {0,0,0,0,0}"); - check(0, result); - int a[] = {1,2,3,4,5}; - result = t.array_sum(a); - System.out.println("Input submitted to the function: {1,2,3,4,5}"); - check(15, result); - int b[] = {1,2,3,0,0}; - result = t.array_sum(b); - System.out.println("Input submitted to the function: {1,2,3,0,0}"); - check(6, result); - int c[] = {1,1,1,1,1}; - result = t.array_sum(c); - System.out.println("Input submitted to the function: {1,1,1,1,1}"); - check(5, result); - } -} diff --git a/testapp/java_files/main_fact.java b/testapp/java_files/main_fact.java deleted file mode 100644 index 325dab6..0000000 --- a/testapp/java_files/main_fact.java +++ /dev/null @@ -1,29 +0,0 @@ -class main_fact -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result); - System.exit(1); - } - } - public static void main(String arg[]) - { - Test t = new Test(); - int result; - result = t.factorial(0); - System.out.println("Input submitted to the function: 0"); - check(1, result); - result = t.factorial(3); - System.out.println("Input submitted to the function: 3"); - check(6, result); - result = t.factorial(4); - System.out.println("Input submitted to the function: 4"); - check(24, result); - } -} diff --git a/testapp/java_files/main_great.java b/testapp/java_files/main_great.java deleted file mode 100644 index 4bfcb1f..0000000 --- a/testapp/java_files/main_great.java +++ /dev/null @@ -1,39 +0,0 @@ -class main_great -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result); - System.exit(1); - } - } - public static void main(String arg[]) - { - Test t = new Test(); - int result; - result = t.greatest(1, 3, 4); - System.out.println("Input submitted to the function: 1, 3, 4"); - check(4, result); - result = t.greatest(5, 10, 3); - System.out.println("Input submitted to the function: 5, 10, 3"); - check(10, result); - result = t.greatest(6, 1, 4); - System.out.println("Input submitted to the function: 6, 1, 4"); - check(6, result); - result = t.greatest(6, 11, 14); - System.out.println("Input submitted to the function: 6, 11, 14"); - check(14, result); - result = t.greatest(3, 31, 4); - System.out.println("Input submitted to the function: 3, 31, 4"); - check(31, result); - result = t.greatest(26, 13, 3); - System.out.println("Input submitted to the function: 26, 13, 3"); - check(26, result); - - } -} diff --git a/testapp/java_files/main_hello_name.java b/testapp/java_files/main_hello_name.java deleted file mode 100644 index 84bb282..0000000 --- a/testapp/java_files/main_hello_name.java +++ /dev/null @@ -1,29 +0,0 @@ -class main_hello_name -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result); - System.exit(1); - } - } - public static void main(String arg[]) - { - Test t = new Test(); - String result; - result = t.hello_name("Raj"); - System.out.println("Input submitted to the function: 'Raj'"); - check("hello Raj", result); - result = t.hello_name("Pratham"); - System.out.println("Input submitted to the function: 'Pratham'"); - check("hello Pratham", result); - result = t.hello_name("Ram"); - System.out.println("Input submitted to the function: 'Ram'"); - check("hello Ram", result); - } -} diff --git a/testapp/java_files/main_lastDigit.java b/testapp/java_files/main_lastDigit.java deleted file mode 100644 index 05439e2..0000000 --- a/testapp/java_files/main_lastDigit.java +++ /dev/null @@ -1,36 +0,0 @@ -class main_lastDigit -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result+"\n"); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result+"\n"); - System.exit(1); - } - } - public static void main(String arg[]) - { - Test t = new Test(); - boolean result; - result= t.lastDigit(12, 2, 13); - System.out.println("Input submitted to the function: 12, 2, 13"); - check(true, result); - result = t.lastDigit(11, 52, 32); - System.out.println("Input submitted to the function: 11, 52, 32"); - check(true, result); - result = t.lastDigit(6, 34, 22); - System.out.println("Input submitted to the function: 6, 34, 22"); - check(false, result); - result = t.lastDigit(6, 46, 26); - System.out.println("Input submitted to the function: 63"); - check(true, result); - result = t.lastDigit(91, 90, 92); - System.out.println("Input submitted to the function: 91"); - check(false, result); - - } -} diff --git a/testapp/java_files/main_moreThan30.java b/testapp/java_files/main_moreThan30.java deleted file mode 100644 index 7da31cb..0000000 --- a/testapp/java_files/main_moreThan30.java +++ /dev/null @@ -1,36 +0,0 @@ -class main_moreThan30 -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result+"\n"); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result+"\n"); - System.exit(1); - } - } - public static void main(String arg[]) - { - Test t = new Test(); - boolean result; - result= t.moreThan30(30); - System.out.println("Input submitted to the function: 30"); - check(false, result); - result = t.moreThan30(151); - System.out.println("Input submitted to the function: 151"); - check(true, result); - result = t.moreThan30(66); - System.out.println("Input submitted to the function: 66"); - check(false, result); - result = t.moreThan30(63); - System.out.println("Input submitted to the function: 63"); - check(true, result); - result = t.moreThan30(91); - System.out.println("Input submitted to the function: 91"); - check(true, result); - - } -} diff --git a/testapp/java_files/main_palindrome.java b/testapp/java_files/main_palindrome.java deleted file mode 100644 index c0745f9..0000000 --- a/testapp/java_files/main_palindrome.java +++ /dev/null @@ -1,29 +0,0 @@ -class main_palindrome -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result+"\n"); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result+"\n"); - System.exit(1); - } - } - public static void main(String arg[]) - { - Test t = new Test(); - boolean result; - result= t.palindrome(123); - System.out.println("Input submitted to the function: 123"); - check(false, result); - result = t.palindrome(151); - System.out.println("Input submitted to the function: 151"); - check(true, result); - result = t.palindrome(23432); - System.out.println("Input submitted to the function: 23432"); - check(true, result); - } -} diff --git a/testapp/java_files/main_square.java b/testapp/java_files/main_square.java deleted file mode 100644 index 5cb8c35..0000000 --- a/testapp/java_files/main_square.java +++ /dev/null @@ -1,32 +0,0 @@ -class main_square -{ - public static <E> void check(E expect, E result) - { - if(result.equals(expect)) - { - System.out.println("Correct:\nOutput expected "+expect+" and got "+result); - } - else - { - System.out.println("Incorrect:\nOutput expected "+expect+" but got "+result); - System.exit(1); - } - } - public static void main(String arg[]) - { - Test t = new Test(); - int result, input, output; - input = 0; output = 0; - result = t.square_num(input); - System.out.println("Input submitted to the function: "+input); - check(output, result); - input = 5; output = 25; - result = t.square_num(input); - System.out.println("Input submitted to the function: "+input); - check(output, result); - input = 6; output = 36; - result = t.square_num(input); - System.out.println("Input submitted to the function: "+input); - check(output, result); - } -} |