File size: 2,364 Bytes
c6d7c4c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
68
69
70
71
72
73
74
75
.Checks: &Checks
    one_argument:
      assert: "len(f.args)"
      eq: 1
    returns_list:
      assert: "isinstance(f.call(0),list)"
      eq: true
    value_1:
      assert: "f.call(1)"
      eq: [0]
    value_2:
      assert: "f.call(2)"
      eq: [0, 1]      
    value_3:
      assert: "f.call(3)"
      eq: [0, 1, 1]
    value_5:
      assert: "f.call(5)"
      eq: [0, 1, 1, 2, 3]

FibonacciZeroShot:
    Signature: "fib(n)"
    Input: "with input element number n (0 based)"
    Output: "the n-th element of the fibbonaci sequence"
    Fact: "The fibonnaci sequence is defined by the boundary conditions fib(0) == 0, fib(1) == 1 and the recursive relation fib(n) == fib(n-1) + fib(n-2)"
    Description: "See if the model can produce a well known sequence"
    Checks:
        one_argument:
          assert: "len(f.args)"
          eq: 1
        input_name:
          assert: "f.args[0].name"
          eq: "n"          
        value_0:
          assert: "f.call(0)"
          eq: 0
        value_1:
          assert: "f.call(1)"
          eq: 1
        value_2:
          assert: "f.call(2)"
          eq: 1
        value_3:
          assert: "f.call(3)"
          eq: 2
        value_5:
          assert: "f.call(5)"
          eq: 5

FibonacciListZeroShot:
    Signature: "fib(n)"
    Input: "with input length n"
    Output: "a list with the first n elements of the fibbonaci sequence"
    Fact: "The fibonnaci sequence is defined by the boundary conditions fib(0) == 0, fib(1) == 1 and the recursive relation fib(n) == fib(n-1) + fib(n-2)"
    Description: "See if the model can produce a well known sequence, explicitly asking for a list"
    Checks:
        <<: *Checks
        input_name:
            assert: "f.args[0].name"
            eq: "n"

FibonacciMisnamed:
    Signature: "glork(bork)"
    Input: "with input length bork"
    Output: "a list with the first bork elements of the fibbonaci sequence"
    Fact: "The fibonnaci sequence is defined by the boundary conditions fib(0) == 0, fib(1) == 1 and the recursive relation fib(n) == fib(n-1) + fib(n-2)"
    Description: "See if the model can produce a well known sequence if the name has been changed"
    Checks: 
        <<: *Checks
        input_name:
            assert: "f.args[0].name"
            eq: "bork"
        func_name:
            assert: "f.name"
            eq: "glork"