-
Notifications
You must be signed in to change notification settings - Fork 15
/
old_comparison_test.sj
148 lines (116 loc) · 2.52 KB
/
old_comparison_test.sj
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
##############################
## WARNING!! Do not run these tests
## Changes to comparison code broken many of them
##############################
ClearAll(a,b,c,d,x)
T 1 == 1
T !(1 != 1)
T !(1 > 1)
T !(1 < 1)
T 1 >= 1
T 1 <= 1
T 1 == 1.0
T 1 < 2
T 2 > 1
T !( 1 > 2)
T !( 2 < 1)
T !( 2 == 1)
T 2 != 1
T 2 >= 1
T 1 <= 2
T !( 1 >= 2 )
T !( 2 <= 1 )
T 1 < 2 < 3
T 3 > 2 > 1
T !( 3 < 2 < 1)
T (1 < 2 < b) == (2 < b)
T ((1 < 2 < b < c == c < 4 < 10)) == ((2 < b) && (b < c) && (c < 4))
T ( (a < c/d) != True )
ClearAll(b,c)
# 1 < x < 1 --> 1 < x && x < 1). FIXME. this should return false.
# This, at least, works.
T Apply(List, 1 < 2 < b < c == c < 4 < 10) == [2 < b,b < c,c < 4]
# Agrees with Mma
T (1 < x > 1) == ( 1 < x && (x > 1) )
T Apply(List, b>2) == [b,>,2]
T Apply(List, 2>b) == [2,>,b]
T Apply(List, a < b) == List(a, < , b)
T Apply(List, a <= b) == List(a, <= , b)
T Apply(List, a >= b) == List(a, >= , b)
T Apply(List, a < 1) == List(a, < , 1)
T Apply(List, a == 1) == List(a, == , 1)
T Apply(List, f(a) < 1) == List(f(a), < , 1)
T Apply(List, f(a) < 1.0) == List(f(a), < , 1.0)
T (a == a ) == True
T (a != a) == False
T (a <= a) == True
T (a >= a) == True
T (a < 1) == (a < 1)
T Sqrt(2) > 0
T -Sqrt(2) < 0
T 3 < Pi < 4
T 2 < E < 3
T 0 < EulerGamma < 1
### Infinity
T 1 != Infinity
T Not(1 == Infinity)
T 1.0 != Infinity
T Not(1.0 == Infinity)
### Not
T Not(a != a) == True
T Not(a == a) == False
T Not(a < b) == (a >= b)
T Head(Not(3)) == Not
### Or
T Or() == False
T Or(1) == 1
T Or(True) == True
T Or(True,False) == True
T Or(False,False) == False
T Or(True,True) == True
T Or(False,True) == True
T Or(True,False,False) == True
# Test flatten with Or
T Args(a || b || c || d ) == [a,b,c,d]
### And
T And() == True
T And(1) == 1
T And(True) == True
T And(False,True) == False
T And(True,False) == False
T And(True,True) == True
T And(False,False) == False
T And(True,True,True) == True
# Test flatten with And
T Args(a && b && c && d ) == [a,b,c,d]
ClearAll(a,b,c,d,f,x)
### Refine
# This belongs elsewhere
ClearAll(aaa)
Assume(aaa,Positive)
T Refine(Abs(aaa)) == aaa
ClearAll(aaa,a)
### String
T Not(f(x) == "cat")
### SameQ
T SameQ(a,a)
T Not(SameQ(a,b))
T Not(SameQ(3,3.0))
T SameQ(3,3)
T SameQ("cat", "cat")
### Equal
T Equal() == True
T Equal(3,3)
T Equal(3,3.0)
T Head(Equal(x,y)) == Equal
T Equal(x,x)
T Equal(2,bf"2")
T Equal(2,big"2")
T Equal(2.0,bf"2")
T Equal(2.0,big"2")
T Not(Unequal(3,3))
T Not(Unequal(3,3.0))
T Not(Unequal(y,y))
T Head(Unequal(x,y)) == Unequal
ClearAll(f,x)
Apply(ClearAll,UserSyms())