summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprathamesh2013-07-02 12:25:33 +0530
committerprathamesh2013-07-02 12:25:33 +0530
commit8a3016a88af5c4a09e8b5683f1e305e9100f3562 (patch)
treec5878e30b59ee084f6b5fd6c5f3e98a097e4960e
parent33366bfa87d62d433cc7541e4699b61be78e5024 (diff)
downloadonline_test-8a3016a88af5c4a09e8b5683f1e305e9100f3562.tar.gz
online_test-8a3016a88af5c4a09e8b5683f1e305e9100f3562.tar.bz2
online_test-8a3016a88af5c4a09e8b5683f1e305e9100f3562.zip
c files moved
-rw-r--r--testapp/c_cpp_files/add.c4
-rw-r--r--testapp/c_cpp_files/add.cpp6
-rw-r--r--testapp/c_cpp_files/array_sum.c10
-rw-r--r--testapp/c_cpp_files/array_sum.cpp10
-rw-r--r--testapp/c_cpp_files/fact.c10
-rw-r--r--testapp/c_cpp_files/fact.cpp16
-rw-r--r--testapp/c_cpp_files/greatest.c15
-rw-r--r--testapp/c_cpp_files/greatest.cpp15
-rw-r--r--testapp/c_cpp_files/hello_name.c16
-rw-r--r--testapp/c_cpp_files/palindrome.c20
-rw-r--r--testapp/c_cpp_files/palindrome.cpp19
-rwxr-xr-xtestapp/code_server.py6
12 files changed, 3 insertions, 144 deletions
diff --git a/testapp/c_cpp_files/add.c b/testapp/c_cpp_files/add.c
deleted file mode 100644
index c829971..0000000
--- a/testapp/c_cpp_files/add.c
+++ /dev/null
@@ -1,4 +0,0 @@
-int add(int a,int b)
-{
- return a-b;
-}
diff --git a/testapp/c_cpp_files/add.cpp b/testapp/c_cpp_files/add.cpp
deleted file mode 100644
index d3b7897..0000000
--- a/testapp/c_cpp_files/add.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include<stdio.h>
-int add(int a,int b)
-{
- printf("All Correct");
- return a;
-}
diff --git a/testapp/c_cpp_files/array_sum.c b/testapp/c_cpp_files/array_sum.c
deleted file mode 100644
index 619a23c..0000000
--- a/testapp/c_cpp_files/array_sum.c
+++ /dev/null
@@ -1,10 +0,0 @@
-int array_sum(int a[5])
-{
- int i=0, sum=0;
- for(i=0;i<5;i++)
- {
- sum = sum + a[i];
- }
- return sum;
-}
-
diff --git a/testapp/c_cpp_files/array_sum.cpp b/testapp/c_cpp_files/array_sum.cpp
deleted file mode 100644
index 9b82d3b..0000000
--- a/testapp/c_cpp_files/array_sum.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-int array_sum(int a[])
-{
- int i=0, sum=0;
- for(i=0;i<5;i++)
- {
- sum = sum + a[i];
- }
- return sum;
-}
-
diff --git a/testapp/c_cpp_files/fact.c b/testapp/c_cpp_files/fact.c
deleted file mode 100644
index e3665f5..0000000
--- a/testapp/c_cpp_files/fact.c
+++ /dev/null
@@ -1,10 +0,0 @@
-int factorial(int a)
-{
- int i,fact=1;
- for(i=1;i<=a;a--)
- {
- fact=fact*a;
- }
- return fact;
-
-}
diff --git a/testapp/c_cpp_files/fact.cpp b/testapp/c_cpp_files/fact.cpp
deleted file mode 100644
index f9b7458..0000000
--- a/testapp/c_cpp_files/fact.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include<stdio.h>
-int fact = 1;
-int factorial(int a)
-{
- printf("%d\n",a);
- if(a<1)
- {
- printf("\nfinal");
- return 1;
- }
- else
- {
- printf("count\n");
- return a*factorial(a-1);
- }
-}
diff --git a/testapp/c_cpp_files/greatest.c b/testapp/c_cpp_files/greatest.c
deleted file mode 100644
index 0194855..0000000
--- a/testapp/c_cpp_files/greatest.c
+++ /dev/null
@@ -1,15 +0,0 @@
-int greatest(int a,int b,int c)
-{
- if(a>b && a>c)
- {
- return a;
- }
- else if(b>c)
- {
- return b;
- }
- else
- {
- return c;
- }
-}
diff --git a/testapp/c_cpp_files/greatest.cpp b/testapp/c_cpp_files/greatest.cpp
deleted file mode 100644
index 0194855..0000000
--- a/testapp/c_cpp_files/greatest.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-int greatest(int a,int b,int c)
-{
- if(a>b && a>c)
- {
- return a;
- }
- else if(b>c)
- {
- return b;
- }
- else
- {
- return c;
- }
-}
diff --git a/testapp/c_cpp_files/hello_name.c b/testapp/c_cpp_files/hello_name.c
deleted file mode 100644
index 8fa2519..0000000
--- a/testapp/c_cpp_files/hello_name.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include<string.h>
-#include<stdio.h>
-
-char *message(char a[])
-{
- return (strcat("hello",a));
-}
-
-main()
-{
- printf("he\n");
- char q[]="re";
- char s[20];
- s= message(q);
- printf("%s",s);
-}
diff --git a/testapp/c_cpp_files/palindrome.c b/testapp/c_cpp_files/palindrome.c
deleted file mode 100644
index 236d963..0000000
--- a/testapp/c_cpp_files/palindrome.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <stdbooll.h>
-bool palindrome(int a)
-{
- int n1, rev = 0, rem;
- n1 = a;
- while (a > 0)
- {
- rem = a % 10;
- rev = rev * 10 + rem;
- a = a / 10;
- }
- if (n1 == rev)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
diff --git a/testapp/c_cpp_files/palindrome.cpp b/testapp/c_cpp_files/palindrome.cpp
deleted file mode 100644
index aae5dd1..0000000
--- a/testapp/c_cpp_files/palindrome.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-bool palindrome(int n)
-{
- int n1, rev = 0, rem;
- n1 = n;
- while (n > 0)
- {
- rem = n % 10;
- rev = rev * 10 + rem;
- n = n / 10;
- }
- if (n1 == rev)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
diff --git a/testapp/code_server.py b/testapp/code_server.py
index ad15501..2fdd11f 100755
--- a/testapp/code_server.py
+++ b/testapp/code_server.py
@@ -252,7 +252,7 @@ class CodeServer(object):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
proc, stdnt_stdout, stdnt_stderr = ret
- if inst_stdout in stdnt_stdout:
+ if inst_stdout == stdnt_stdout:
return True, 'Correct answer'
else:
err = "Error: expected %s, got %s" % (inst_stderr,
@@ -284,7 +284,7 @@ class CodeServer(object):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
proc, stdnt_stdout, stdnt_stderr = ret
- valid_answer = inst_stdout in stdnt_stdout
+ valid_answer = inst_stdout == stdnt_stdout
if valid_answer and (num_lines == loop_count):
return True, "Correct answer"
else:
@@ -293,7 +293,7 @@ class CodeServer(object):
return False, err
def run_c_code(self, answer, test_code, in_dir=None):
- """Tests given C code (`answer`) with the `test_code` supplied.
+ """Tests given C code<F12> (`answer`) with the `test_code` supplied.
The testcode is a path to the reference code.
The reference code will call the function submitted by the student.