300
|
1 |
|
249
|
2 |
|
474
|
3 |
def urbanmain() = {
|
|
4 |
import C3b._
|
249
|
5 |
|
|
6 |
|
474
|
7 |
assert(syard(split("3 + 4 * ( 2 - 1 )")) == List("3", "4", "2", "1", "-", "*", "+"))
|
|
8 |
assert(syard(split("( ( ( 3 ) ) + ( ( 4 + ( 5 ) ) ) )")) == List("3", "4", "5", "+", "+"))
|
|
9 |
assert(syard(split("5 + 7 / 2")) == List("5", "7", "2", "/", "+"))
|
|
10 |
assert(syard(split("5 * 7 / 2")) == List("5", "7", "*", "2", "/"))
|
|
11 |
assert(syard(split("3 + 4 * 8 / ( 5 - 1 ) ^ 2 ^ 3")) == List("3", "4", "8", "*", "5", "1", "-", "2", "3", "^", "^", "/", "+"))
|
|
12 |
|
|
13 |
assert(compute(syard(split("3 + 4 * ( 2 - 1 )"))) == 7)
|
|
14 |
assert(compute(syard(split("10 + 12 * 33"))) == 406)
|
|
15 |
assert(compute(syard(split("( 5 + 7 ) * 2"))) == 24)
|
|
16 |
assert(compute(syard(split("5 + 7 / 2"))) == 8)
|
|
17 |
assert(compute(syard(split("5 * 7 / 2"))) == 17)
|
|
18 |
assert(compute(syard(split("9 + 24 / ( 7 - 3 )"))) == 15)
|
|
19 |
assert(compute(syard(split("4 ^ 3 ^ 2"))) == 262144)
|
|
20 |
assert(compute(syard(split("4 ^ ( 3 ^ 2 )"))) == 262144)
|
|
21 |
assert(compute(syard(split("( 4 ^ 3 ) ^ 2"))) == 4096)
|
|
22 |
assert(compute(syard(split("( 3 + 1 ) ^ 2 ^ 3"))) == 65536)
|
|
23 |
}
|