1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<problem name = "Test all IO">
<desc>Write a program which does the following:
<ol>
<li>Gets the value of a variable "foo" and prints it to stdout.</li>
<li>Gets the contents of a file "input.txt" and prints it to stdout.
</li>
<li>Gets the contents of stdin and writes it to a file "output.txt".
</li>
</ol>
</desc>
<include>
<!-- Here you can place any Python functions to use for normalisation.
Note: "id" will be in our standard test functions lib.
-->
<![CDATA[
def id(x):
return x
]]>
</include>
<solution>
<![CDATA[
# Sample solution, used to generate test output
input1 = raw_input()
input2 = file('input.txt').read()
input3 = foo
print input3
print input2
f = file('output.txt','w')
f.write(input1)
f.close()
]]>
</solution>
<!-- Alternatively, <solution src="all_input_test_soln.py" /> -->
<case name="All Tests">
<!-- Specify input -->
<stdin>This is Standard Input</stdin>
<file name='input.txt'>
File Input
</file>
<var name="foo" value="'Variable Input'" />
<!-- Functions test varying levels of compliance with the spec -->
<!-- 'default="match"' means exactly match any unlisted files.
(The default behaviour)
'default="ignore"' means ignore any unlisted files.
-->
<!-- Match stdout case insensitive, output.txt match exactly,
and ignore other files. -->
<function desc="Match case insensitive and ignore other files"
default="ignore">
<stdout>str.lower</stdout>
<!-- 'type="norm"' treats the function as a normalisation
function (the default behaviour).
'type="check"' treats it as a 2-argument check. -->
<file name="output.txt" type="norm">str.lower</file>
</function>
<function desc="Match expected files" default="ignore">
<stdout/>
<file name="output.txt"/>
</function>
<!-- Match all files exactly, even those not listed. -->
<function desc="Match output, no unexpected files allowed" />
</case>
</problem>
|