111 lines
3.1 KiB
Plaintext
111 lines
3.1 KiB
Plaintext
|
|
import.version:2.0.1 {unitt}!
|
||
|
|
import {src/two-bucket}!
|
||
|
|
|
||
|
|
suite "Two Bucket" [
|
||
|
|
|
||
|
|
test "Measure using bucket one of size 3 and bucket two of size 5 - start with bucket one" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 3
|
||
|
|
bucketTwo: 5
|
||
|
|
goal: 1
|
||
|
|
startBucket: "one"
|
||
|
|
]
|
||
|
|
assert -> result\moves = 4
|
||
|
|
assert -> result\goalBucket = "one"
|
||
|
|
assert -> result\otherBucket = 5
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "Measure using bucket one of size 3 and bucket two of size 5 - start with bucket two" [
|
||
|
|
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 3
|
||
|
|
bucketTwo: 5
|
||
|
|
goal: 1
|
||
|
|
startBucket: "two"
|
||
|
|
]
|
||
|
|
assert -> result\moves = 8
|
||
|
|
assert -> result\goalBucket = "two"
|
||
|
|
assert -> result\otherBucket = 3
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "Measure using bucket one of size 7 and bucket two of size 11 - start with bucket one" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 7
|
||
|
|
bucketTwo: 11
|
||
|
|
goal: 2
|
||
|
|
startBucket: "one"
|
||
|
|
]
|
||
|
|
assert -> result\moves = 14
|
||
|
|
assert -> result\goalBucket = "one"
|
||
|
|
assert -> result\otherBucket = 11
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "Measure using bucket one of size 7 and bucket two of size 11 - start with bucket two" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 7
|
||
|
|
bucketTwo: 11
|
||
|
|
goal: 2
|
||
|
|
startBucket: "two"
|
||
|
|
]
|
||
|
|
assert -> result\moves = 18
|
||
|
|
assert -> result\goalBucket = "two"
|
||
|
|
assert -> result\otherBucket = 7
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "Measure one step using bucket one of size 1 and bucket two of size 3 - start with bucket two" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 1
|
||
|
|
bucketTwo: 3
|
||
|
|
goal: 3
|
||
|
|
startBucket: "two"
|
||
|
|
]
|
||
|
|
assert -> result\moves = 1
|
||
|
|
assert -> result\goalBucket = "two"
|
||
|
|
assert -> result\otherBucket = 0
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "Measure using bucket one of size 2 and bucket two of size 3 - start with bucket one and end with bucket two" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 2
|
||
|
|
bucketTwo: 3
|
||
|
|
goal: 3
|
||
|
|
startBucket: "one"
|
||
|
|
]
|
||
|
|
assert -> result\moves = 2
|
||
|
|
assert -> result\goalBucket = "two"
|
||
|
|
assert -> result\otherBucket = 2
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "Not possible to reach the goal" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 6
|
||
|
|
bucketTwo: 15
|
||
|
|
goal: 5
|
||
|
|
startBucket: "one"
|
||
|
|
]
|
||
|
|
assert -> null? result
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "With the same buckets but a different goal, then it is possible" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 6
|
||
|
|
bucketTwo: 15
|
||
|
|
goal: 9
|
||
|
|
startBucket: "one"
|
||
|
|
]
|
||
|
|
assert -> result\moves = 10
|
||
|
|
assert -> result\goalBucket = "two"
|
||
|
|
assert -> result\otherBucket = 0
|
||
|
|
]
|
||
|
|
|
||
|
|
test.skip "Goal larger than both buckets is impossible" [
|
||
|
|
result: measure #[
|
||
|
|
bucketOne: 5
|
||
|
|
bucketTwo: 7
|
||
|
|
goal: 8
|
||
|
|
startBucket: "one"
|
||
|
|
]
|
||
|
|
assert -> null? result
|
||
|
|
]
|
||
|
|
]
|