summaryrefslogtreecommitdiff
path: root/src/unit_tests.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-03-30 23:34:08 +0100
committerMaxime Coste <frrrwww@gmail.com>2015-03-30 23:37:55 +0100
commit335c73a09b038e80faa6e61906041e7392c15532 (patch)
treed1a72419979b0114437c13e394cacf215f46e743 /src/unit_tests.cc
parent166682d80231118f85ec07af23118c14b7e22a22 (diff)
Use custom implementation rather the sscanf in str_to_int
Diffstat (limited to 'src/unit_tests.cc')
-rw-r--r--src/unit_tests.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/unit_tests.cc b/src/unit_tests.cc
index 9fb1bae2..5c43c848 100644
--- a/src/unit_tests.cc
+++ b/src/unit_tests.cc
@@ -139,6 +139,12 @@ void test_string()
kak_assert(not subsequence_match("tchou kanaky", "tchou kanaky"));
kak_assert(format("Youhou {1} {} {0} \\{}", 10, "hehe", 5) == "Youhou hehe 5 10 {}");
+
+ kak_assert(str_to_int("5") == 5);
+ kak_assert(str_to_int(to_string(INT_MAX)) == INT_MAX);
+ kak_assert(str_to_int(to_string(INT_MIN)) == INT_MIN);
+ kak_assert(str_to_int("00") == 0);
+ kak_assert(str_to_int("-0") == 0);
}
void test_keys()