-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_cases.txt
212 lines (193 loc) · 6.27 KB
/
test_cases.txt
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# Test cases for the human calc engine
# These test cases can be run by running
# python3 human_calc.py test
# Generally the order of the cases doesn't matter, unless otherwise noted
# Each line is a JSON Array, the first element is the formula to run, the
# second is the expected results. Comments start with '#'. Expected results
# use a "|" instead of a newline for results that return more than one line.
# Note that the examples in README.md are also run as test cases
# Basic stuff
["1 + 2", "3"]
["10 * last", "30"] # Must be after a test that returns 3
# Test state logic
["reset", "State reset"]
["show", "No variables"]
# Sum tests
["50", "50"]
["100", "100"]
["150", "150"]
["sum", "300"]
["average", "100"]
# Test variables, and that we can't set the auto-variable
["last = 123", "last = 123"]
["test = 42", "42"]
["other = 52", "52"]
["show", "other: 52|test: 42"]
["a: 2", "2"]
["b = 3", "3"]
["c: 4", "4"]
["a * b * c", "24"]
["magic: 500 + 5 * 11", "555"]
["2 * magic", "1,110"] # Must be after a test that sets magic to 555
["magic", "555"] # Must be after a test that sets magic to 555
["magic - 5", "550"] # Must be after a test that sets magic to 555
["1 + 2 + 3", "6"]
["+ 10", "16"] # Must be after a test that returns 6
["-5", "11"] # Must be after a test that returns 16
["-40 f as c", "-40\u00B0C"]
# More basic tests
["1 / 0", "ERROR: In '/'"]
["12,345 * 10", "123,450"]
["5+10", "15"]
["2 * 3", "6"]
["5 / 2", "2.5"]
["100 - 95", "5"]
["1 + 2 + 3 + 4 + 5", "15"]
["2 + 3 * 5", "17"]
["1 + ((2 + 3) * 5)", "26"]
["123 & 321", "65"]
["123 | 321", "379"]
["123 xor 321", "314"]
["1234 and 4321", "192"]
["1234 or 4321", "5,363"]
["(0b1100 | 0b0011) & 0b11111", "0b1111"]
["123 << 2", "492"]
["1284 >> 2", "321"]
["4321 mod 66", "31"]
["4/3", "1.3333333"]
["4000/3", "1,333.333"]
["4000000/3", "1,333,333.33"]
["2(3+1)", "8"]
["5!", "120"]
["10! - 3,600,000", "28,800"]
# Units (the currency ones use a test version of the currency data)
["1km + 2500m", "3.5km"]
["5 kilometer + 2 km", "7km"]
["1km + 2000m in meter", "3,000m"]
["50 * -5", "-250"]
["212f in c", "100\u00B0C"]
["100c to f", "212\u00B0F"]
["$1 in eur", "\u20AC0.86"]
["$1 in btc", "0.000017 Bitcoin"]
["$100 in eth", "0.0253 Ethereum"]
["$200 in doge", "836.67 Dogecoin"]
["$1 in yen", "\u00A5113.75"]
["1 btc in usd", "$58,526.70"]
["10 gbp in usd", "$13.75"]
["10 pounds in dollars", "$13.75"]
["10 usd in gbp", "\u00A37.27"]
["10 usd in pounds", "\u00A37.27"]
["12gb in bytes / 1024", "12,582,912b"]
["10 kb / 2 sec", "5kb/s"]
["53 gb per 1.5 hours as mb/s", "10.05037mb/s"]
["53 gb in 1.5 hours as mb/s", "10.05037mb/s"]
["12gb per s as mb/s", "12,288mb/s"]
["1024mbps in gb/s", "1gb/s"]
["100kph in mph", "62.13712mi/h"]
["1024 * 1024 * 1.5 bytes in mb", "1.5mb"]
["5 gb / 2.5gb/s", "2 seconds"]
["30gb / 20mb/s in minutes", "25.6 minutes"]
["1in in cm", "2.54cm"]
["1inch in cm", "2.54cm"]
["5 pounds / 8 ounces", "10"]
["5k in mi", "3.106856mi"]
["90 minutes * 50 kph", "75km"]
["(1 hours * 512 megabits/sec) in gb", "225gb"]
["30 minutes * 4.5 mph", "2.25mi"]
["2mbps * 300 seconds", "600mb"]
["2mbps * 5 minutes", "600mb"]
# Date tests (tests assumes the current time is 2021-07-01 12:34:56, and a local timezone of UTC-5)
["24 hours in days", "1 days"]
["1 year in months", "12 months"]
["1 year in days", "365 days"]
["1 year in weeks", "52 weeks"]
["1 month in weeks", "4 weeks"]
["12 months in years", "1 years"]
["365 days in years", "1 years"]
["52 weeks in years", "1 years"]
["4 weeks in months", "1 months"]
["2021-01-01 + 7 days", "2021-01-08"]
["2021-01-01 + 2 weeks", "2021-01-15"]
["2000-01-02 + 52 weeks", "2000-12-31"]
["2000-02-05 - 2000-01-05", "1 months"]
["2000-02-05 - 1980-02-05", "20 years"]
["2021-01-30 - 2021-01-25", "5 days"]
["Jan 30 - January 20, 2021", "10 days"]
["sept 1 2021 - AUG 1", "1 months"]
["today + 2 weeks", "2021-07-15"]
["now + 2 weeks", "2021-07-15 12:34:56"]
["now + 2 hours", "2021-07-01 14:34:56"]
["now - 2 weeks", "2021-06-17 12:34:56"]
["now - 2 hours", "2021-07-01 10:34:56"]
["utcnow + 2 weeks", "2021-07-15 17:34:56"]
["utcnow + 2 hours", "2021-07-01 19:34:56"]
["(utcnow - now) in hours", "5 hours"]
["12:00 + 1 hour", "13:00:00"]
["1:23:45 + 90 minutes", "02:53:45"]
["5/6/1950 1:23:45 + 25 hours", "1950-05-07 02:23:45"]
["2:00 + 30 min", "02:30:00"]
["12:00 + 150 sec", "12:02:30"]
["12:00 + 300 seconds", "12:05:00"]
["12:00 + 48 hours", "2d 12:00:00"]
["2 years + 12 months", "3 years"]
["2021-01-31 + 30 days", "2021-03-02"]
["2021-01-01 + 1 month", "2021-02-01"]
["2021-01-31 + 1 month", "2021-02-28"]
["2021-01-31 + 5 months", "2021-06-30"]
["2021-01-31 - 2 months", "2020-11-30"]
["2021-01-01 + 1 year", "2022-01-01"]
["2021-01-01 + 10 years", "2031-01-01"]
["2021-01-31 + 1 year", "2022-01-31"]
["2020-02-29 + 1 year", "2021-02-28"]
# Test the auto use of "last"
["2 + 3", "5"]
["+2", "7"] # Must be after a test that returns 5
["*4", "28"] # Must be after a test that returns 7
["/2", "14"] # Must be after a test that returns 28
["-10", "4"] # Must be after a test that returns 14
["32 ounces * 2", "64 ounces"]
["in pounds", "4 pounds"] # Must be after a test that returns 64 ounces
["as kg", "1.8143695 kilograms"] # Must be after a test that returns 64 ounces
# Some error cases
["1 + 2 ()", "3 *"]
["()", "<None>"]
# Percent and percent like things
[".3 * 10", "3"]
["50% * 40", "20"]
["25% of 80", "20"]
# Constants and multipliers
["23 million 5 thousand", "23,005,000"]
["pi / e", "1.1557273"]
["10 ^ 2", "100"]
# Different math functions
["(1+4)^2+5", "30"]
["sqrt(12 * 12)", "12"]
["abs(-100)", "100"]
["floor(123.45)", "123"]
["ceiling(123.45)", "124"]
["cos(60)", "0.5"]
["acos(0.5)", "60"]
["sin(30)", "0.5"]
["asin(0.5)", "30"]
["tan(45)", "1"]
["atan(1)", "45"]
["log(10 ^ 1.23)", "1.23"]
["value(100 miles) + 50", "150"]
["100 miles + 50", "150mi"]
# Bases
["0x1 + 0x1", "0x2"]
["0o1 + 0o1", "0o2"]
["0b1 + 0b1", "0b10"]
["255 in hex", "0xff"]
["493 in oct", "0o755"]
["455 in binary", "0b111000111"]
["(0b11 + 0o12 + 0x13) in dec", "32"]
["0xfabaceae in decimal", "4,206,546,606"]
["0xFABACEAE in octal", "0o37256547256"]
# Some English words
["hundred", "100"]
["one hundred twenty three", "123"]
["one hundred twenty-three", "123"]
["six hundred four thousand three hundred one", "604,301"]
["12 in English", "Twelve"]
["-5 in English", "Negative five"]