Add the parser to parse the string as an integer if it's needed.

This commit is contained in:
2023-10-23 15:51:30 +03:00
parent 553f4788e4
commit d357e82b54
2 changed files with 25 additions and 1 deletions
@@ -4,7 +4,7 @@
[cipher-analytical-machine.parsers.parsers :refer :all]))
(deftest unsigned-int?-test
(testing ""
(testing "The function return true only for an unsingned integer as a string."
(are [str expected]
(= expected
(unsigned-int? str))
@@ -13,3 +13,13 @@
"-10" false
"abc" false)))
(deftest parse-unsigned-int-test
(testing "The function parse the integer if the string is an integer."
(are [str-or-int expected]
(= expected
(parse-unsigned-int str-or-int))
"9" 9
9 9
"10" 10
"-10" nil
"abc" nil)))