summaryrefslogtreecommitdiffstats
path: root/test/basic.tcl
blob: 59622087cdada852aac193a8b74504ca863d601c (plain)
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
proc count condition {
    Statements::count $condition
}

Assert programOakland has program {{this} {
    Claim Omar lives in "Oakland"
}}
Assert when $::thisProcess has step count /c/ {{c} {
    When Omar lives in /place/ {
        Claim $place is a place where Omar lives
    }
}}
Assert programNewYork has program {{this} {
    Claim Omar lives in "New York"
}}
Step

assert {[count [list /someone/ claims /p/ is a place where Omar lives]] == 2}

Assert programNewJersey has program {{this} {
    Claim Omar lives in "New Jersey"
}}
Step

assert {[count [list /someone/ claims /p/ is a place where Omar lives]] == 3}

set ::outlinecolors [dict create]
Assert someone wishes BlueThing is outlined blue
Assert someone claims BlueThing has region BlueThingRegion
Assert when /someone/ wishes /thing/ is outlined /color/ {{thing color} {
    When $thing has region /r/ {
        dict set ::outlinecolors $thing $color
    }
}}
set ::joinoutlinecolors [dict create]
Assert programJoin has program {{this} {
    When /someone/ wishes /thing/ is outlined /color/ & /thing/ has region /r/ {
        dict set ::joinoutlinecolors $thing $color
    }
}}
Assert someone wishes GreenThing is outlined green
Assert someone claims GreenThing has region GreenThingRegion
Step

assert {$::outlinecolors eq "BlueThing blue GreenThing green"}
assert {$::outlinecolors eq $::joinoutlinecolors}

Assert someone claims BlueThing has region BlueThingRegion2
Retract someone claims BlueThing has region BlueThingRegion
Step

assert {$::outlinecolors eq "BlueThing blue GreenThing green"}
assert {$::outlinecolors eq $::joinoutlinecolors}

Assert "New York" is a city
Assert "New York" is where the studio is
Assert "New York" is where Omar lives
set ::properties [list]
Assert when the program is running {{} {
    When "New York" is /...property/ {
        lappend ::properties $property
    }
}}
Assert the program is running
Step
# TODO: this would ideally sort
assert {$::properties eq {{a city} {where the studio is} {where Omar lives} {a place where Omar lives}}}

Retract the program is running
Step