|
@@ -51,3 +51,24 @@ assert_eq(asech(0.3), 1.873820, 1e-5)
|
|
|
|
|
|
assert_eq(csch(0.3), 3.283853, 1e-5)
|
|
assert_eq(csch(0.3), 3.283853, 1e-5)
|
|
assert_eq(acsch(0.3), 1.918896, 1e-5)
|
|
assert_eq(acsch(0.3), 1.918896, 1e-5)
|
|
|
|
+
|
|
|
|
+# strings
|
|
|
|
+
|
|
|
|
+assert_eq(str_length(""), 0)
|
|
|
|
+assert_eq(str_length("foo"), 3)
|
|
|
|
+
|
|
|
|
+assert(str_slice("hello world", 0, 5) == "hello")
|
|
|
|
+assert(str_slice("hello world", 6, 11) == "world")
|
|
|
|
+assert(str_slice("hello world", 0, 0) == "")
|
|
|
|
+assert(str_slice("hello world", 0, 100) == "")
|
|
|
|
+
|
|
|
|
+assert(str_append("foo", "bar") == "foobar")
|
|
|
|
+
|
|
|
|
+assert(str_contains("hello world", "hello"))
|
|
|
|
+assert(str_contains("hello world", "world"))
|
|
|
|
+assert(str_contains("hello world", "HELLO") == false)
|
|
|
|
+
|
|
|
|
+assert(str_replace("hello world", "hello", "HEY") == "HEY world")
|
|
|
|
+assert(str_replace("xxx", "x", "yY") == "yYyYyY")
|
|
|
|
+
|
|
|
|
+assert(str_repeat("xy", 3) == "xyxyxy")
|