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
|
<exercise name = "Sum numbers in a file">
<solution>
<![CDATA[
print sum(map(int,file(raw_input()).readlines()))
]]>
</solution>
<!-- Alternatively, <solution src="all_input_test_soln.py" /> -->
<case name="Normal case">
<!-- Specify input -->
<stdin>input.txt</stdin>
<file name='input.txt'><![CDATA[
1
2
3
]]>
</file>
<function desc="Match" default="match"/>
</case>
<case name="Negative numbers">
<!-- Specify input -->
<stdin>input.txt</stdin>
<file name='input.txt'><![CDATA[
1
2
-5
]]>
</file>
<function desc="Match" default="match"/>
</case>
<case name="No input">
<!-- Specify input -->
<stdin>input.txt</stdin>
<file name='input.txt'><![CDATA[
]]>
</file>
<function desc="Match" default="match"/>
</case>
<case name="File does not exist">
<!-- Specify input -->
<stdin>non_existant_file.txt</stdin>
<file name='input.txt'><![CDATA[
]]>
</file>
<exception name="IOError"/>
<function desc="Match exception" default="ignore">
<exception/>
</function>
</case>
</exercise>
|