36 lines
1.5 KiB
Plaintext
36 lines
1.5 KiB
Plaintext
present(value: null) (answer: Bool) { answer = false }
|
|
present(value: Uuid) (answer: Bool) {
|
|
values = { value = 1 }
|
|
values = put(values, value, 2)
|
|
answer = uuid.toText(value) == "550e8400-e29b-41d4-a716-446655440000" and get(values, value) == 2 and length(values) == 1
|
|
}
|
|
|
|
verify() (answer: Bool) pure {
|
|
answer = present(uuid.parse("550E8400-E29B-41D4-A716-446655440000")) and uuid.parse("550e8400e29b41d4a716446655440000") == null and uuid.parse("00000000-0000-0000-0000-00000000000-") == null
|
|
}
|
|
|
|
normalized(value: null) (text: Text?) pure { text = null }
|
|
normalized(value: Uuid) (text: Text?) pure { text = uuid.toText(value) }
|
|
|
|
roundtrip(text: Text) (value: Text?) pure { value = normalized(uuid.parse(text)) }
|
|
|
|
batchWithPending(values: List<Text>) (formatted: List<Text?>) {
|
|
pending = run(dever.task.sleep(60000))
|
|
formatted = each(roundtrip, values)
|
|
stop(pending)
|
|
}
|
|
|
|
batchVerify() (answer: Bool) {
|
|
values = ["550E8400-E29B-41D4-A716-446655440000", "invalid"]
|
|
formatted = batchWithPending(values)
|
|
empty = batchWithPending([])
|
|
invalid = batchWithPending(["invalid"])
|
|
answer = length(formatted) == 2 and first(formatted) == "550e8400-e29b-41d4-a716-446655440000" and length(invalid) == 1 and first(invalid) == null and length(empty) == 0 and values == ["550E8400-E29B-41D4-A716-446655440000", "invalid"]
|
|
}
|
|
|
|
taskVerify() (answer: Bool) {
|
|
pending = run(roundtrip("550E8400-E29B-41D4-A716-446655440000"))
|
|
value = wait(pending)
|
|
answer = value == roundtrip("550E8400-E29B-41D4-A716-446655440000")
|
|
}
|