forked from pannous/english-script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
selector_test.rb
executable file
·74 lines (61 loc) · 2.15 KB
/
selector_test.rb
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
#!/usr/bin/env ruby
$use_tree=false
# $verbose=false
require_relative '../parser_test_helper'
class SelectorTest < ParserBaseTest
include ParserTestHelper
def test_every
parse "xs= [1,2,3]; increase all xs"
skip
parse "xs= [1,2,3]; show all xs" # todo: ruby => rest_of_statement
parse "xs= [1,2,3]; show every xs"
parse "friendly numbers= [1,2,3]; show all friendly numbers"
parse "friendly numbers= [1,2,3]; show every friendly number"
#p "print every item in [1,2,3]"
#p "print every number in [1,2,3]"
#p "friendly numbers= [1,2,3]; friendly numbers which are smaller than three "
end
# OK when testing!?!
# BUG! def pointer.-
# GETS FUCKED UP BY @string.strip! !!! ???
def test_selector0
parse "xs= 2,3,8,9"
init "xs that are smaller than 7" # BUG 'maller t'
[email protected] # BUG! def pointer.-
assert_equals z,[2,3]
z=parse "let z be all xs that are smaller than 7 "
assert_equals z,[2,3]
z=parse "let z be xs that are smaller than 7 "
assert_equals z,[2,3]
#assert " {xs<7} = 2,3 "
#s " xs that are smaller than 7 == [2,3]"
#condition
#assert " xs that are smaller than 7 == [2,3]"
#assert "those xs that are smaller than seven are 2,3"
#assert "those xs that are smaller than seven are the same as 2,3"
end
#todo simplify
# those xs that are smaller than seven are the same as 2,3
def test_selector1
parse "xs= 1,2,3"
init " xs that are bigger than one"
assert_equals z,[2,3]
assert "xs that are bigger than one == [2,3]"
#s " xs that are bigger than one == [2,3]"
#condition
#assert " xs that are bigger than one == [2,3]"
end
def test_every_selector
skip
parse "friendly numbers= [1,2,3]; show every friendly number that is bigger than one"
parse "friendly numbers= [1,2,3]; all friendly numbers which are smaller than three == [1,2]"
end
def test_selector3
skip
assert("every number in 1,'a',3 ==1,3")
assert("all numbers in 1,'a',3 ==1,3")
assert("all negative numbers in 1,-2,3,-4 ==-2,-4")
assert("all numbers in 1,-2,3,-4 that are negative == -2,-4")
end
end