]> mj.ucw.cz Git - moe.git/commitdiff
Saved the example task
authorMartin Mares <mj@ucw.cz>
Sat, 15 Aug 2009 01:08:46 +0000 (03:08 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 15 Aug 2009 01:08:46 +0000 (03:08 +0200)
t/problems/sum/1.config [new file with mode: 0644]
t/problems/sum/1.in [new file with mode: 0644]
t/problems/sum/1.out [new file with mode: 0644]
t/problems/sum/2.in [new file with mode: 0644]
t/problems/sum/2.out [new file with mode: 0644]
t/problems/sum/config [new file with mode: 0644]
t/problems/sum/extras.h [new file with mode: 0644]
t/solutions/mj/sum/sum.c [new file with mode: 0644]

diff --git a/t/problems/sum/1.config b/t/problems/sum/1.config
new file mode 100644 (file)
index 0000000..ce36b74
--- /dev/null
@@ -0,0 +1 @@
+POINTS_PER_TEST=2
diff --git a/t/problems/sum/1.in b/t/problems/sum/1.in
new file mode 100644 (file)
index 0000000..b85905e
--- /dev/null
@@ -0,0 +1 @@
+1 2 3
diff --git a/t/problems/sum/1.out b/t/problems/sum/1.out
new file mode 100644 (file)
index 0000000..1e8b314
--- /dev/null
@@ -0,0 +1 @@
+6
diff --git a/t/problems/sum/2.in b/t/problems/sum/2.in
new file mode 100644 (file)
index 0000000..aacb595
--- /dev/null
@@ -0,0 +1 @@
+1 2 3 4 5
diff --git a/t/problems/sum/2.out b/t/problems/sum/2.out
new file mode 100644 (file)
index 0000000..60d3b2f
--- /dev/null
@@ -0,0 +1 @@
+15
diff --git a/t/problems/sum/config b/t/problems/sum/config
new file mode 100644 (file)
index 0000000..9c29ccb
--- /dev/null
@@ -0,0 +1,33 @@
+# Per-task config
+# All variables can be overriden in test-specific <test>.config
+
+# A list of all tests
+TESTS=1
+TESTS+=2 3
+
+# Test with example input
+SAMPLE_TESTS=1
+
+# Number of points per test
+POINTS_PER_TEST=1
+
+# List of extra files needed for compilation
+EXTRAS="extras.h"
+
+# Time limit in seconds
+TIME_LIMIT=10
+
+# Memory limit in kilobytes
+MEM_LIMIT=16384
+
+# Command used to check output syntax (optional)
+SYNTAX_CHECK=grep -v -- - $TDIR/$TEST.out >/dev/null
+
+# Command used to check output correctness
+OUTPUT_CHECK=diff -bBu $TDIR/$TEST.ok $TDIR/$TEST.out && echo >$TDIR/$TEST.pts 22
+
+OUTPUT_FILTER=tr -d '\r' <$TDIR/$TEST.raw >$TDIR/$TEST.out
+
+TEST_1_EXT_c_TIME_LIMIT=9.9
+
+IO_TYPE=file
diff --git a/t/problems/sum/extras.h b/t/problems/sum/extras.h
new file mode 100644 (file)
index 0000000..b3ff325
--- /dev/null
@@ -0,0 +1 @@
+/* Dummy header we're testing */
diff --git a/t/solutions/mj/sum/sum.c b/t/solutions/mj/sum/sum.c
new file mode 100644 (file)
index 0000000..a91e54c
--- /dev/null
@@ -0,0 +1,14 @@
+#include <stdio.h>
+
+int main(void)
+{
+  int x;
+  int sum = 0;
+  FILE *fi = fopen("sum.in", "r");
+  FILE *fo = fopen("sum.out", "w");
+
+  while (fscanf(fi, "%d", &x) == 1)
+    sum += x;
+  fprintf(fo, "%d\n", sum);
+  return 0;
+}