1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-11-08 20:06:24 +00:00
millfork/examples/tests/test_string.mfk
2020-04-06 13:27:39 +02:00

26 lines
718 B
Plaintext

import string
import framework
void test_string() {
array buffer[256]
start_suite("string"z)
assert_equal(0, strzcmp("a"z, "a"z))
assert_equal(-1, strzcmp("a"z, "b"z))
assert_equal(-1, strzcmp("a"z, "ab"z))
assert_equal(1, strzcmp("b"z, "a"z))
assert_equal(1, strzcmp("ab"z, "a"z))
strzcopy(buffer, "test"z)
assert_equal(4, strzlen(buffer))
assert_equal(0, strzcmp("test"z, buffer))
strzappend(buffer, "hello"z)
assert_equal(9, strzlen(buffer))
assert_equal(0, strzcmp("testhello"z, buffer))
assert_equal(1234, strz2word("1234"z))
strzcopy(buffer, "test****test"z)
strzpaste(buffer+4, "test"z)
assert_equal(0, strzcmp("testtesttest"z, buffer))
}