~azzar1/unity/add-show-desktop-key

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