diff --git a/lib/soml/parfait/integer.soml b/lib/soml/parfait/integer.soml new file mode 100644 index 00000000..4a5bb5a8 --- /dev/null +++ b/lib/soml/parfait/integer.soml @@ -0,0 +1,35 @@ +class Integer < Value + Word digit( int rest ) + if_zero( rest == 5 ) + return "5" + end + if_zero( rest == 1 ) + return "1" + end + if_zero( rest == 2 ) + return "2" + end + if_zero( rest == 3 ) + return "3" + end + if_zero( rest == 4 ) + return "4" + end + end + Word add_string(Word str) + int div + div = self / 10 + int rest + rest = self - div + if_notzero( rest ) + rest = self.digit( rest ) + else + str = div.add_string(str) + end + return str + end + Word to_string() + Word start = " " + return add_string( start ) + end +end diff --git a/test/interpreter/test_puti.rb b/test/interpreter/test_puti.rb deleted file mode 100644 index 1e72d754..00000000 --- a/test/interpreter/test_puti.rb +++ /dev/null @@ -1,91 +0,0 @@ -require_relative "helper" - -class AddTest < MiniTest::Test - include Ticker - include AST::Sexp - - def test_puti - @string_input = <