From f2bab03ecc75bf45554a310517fe29818adb07b4 Mon Sep 17 00:00:00 2001 From: inglorion Date: Sat, 12 Jul 2014 19:49:05 -0700 Subject: [PATCH] added test for if to test_voodoo_translator --- test/test_voodoo_translator.out | 11 +++++++++++ test/test_voodoo_translator.voo | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/test/test_voodoo_translator.out b/test/test_voodoo_translator.out index 3519454..b12e103 100644 --- a/test/test_voodoo_translator.out +++ b/test/test_voodoo_translator.out @@ -9,3 +9,14 @@ function return 17 end block end function + +align +main: +function argc argv + block + ifeq argc @true + call answer + end if + + end block +end function diff --git a/test/test_voodoo_translator.voo b/test/test_voodoo_translator.voo index 58d31dd..276d4b8 100644 --- a/test/test_voodoo_translator.voo +++ b/test/test_voodoo_translator.voo @@ -1,9 +1,16 @@ section data +argc_str: string "argc" +argv_str: string "argv" answer_str: string "answer" +call_str: string "call" +eq_str: string "eq" equals_str: string "=" function_str: string "function" functions_str: string "functions" +if_str: string "if" +main_str: string "main" +n_str: string "n" return_str: string "return" section_str: string "section" the_answer_str: string "the_answer" @@ -26,10 +33,22 @@ function argc argv let voodoo call make_voodoo_translator + let argc_b call make_blob argc_str 4 + let argc_sym call intern argc_b + let argv_b call make_blob argv_str 4 + let argv_sym call intern argv_b + let call_b call make_blob call_str 4 + let call call intern call_b + let eq_b call make_blob equals_str 2 + let eq call intern eq_b let equals_b call make_blob equals_str 1 let equals call intern equals_b let functions_b call make_blob functions_str 9 let functions call intern functions_b + let if_b call make_blob if_str 2 + let if call intern if_b + let main_b call make_blob main_str 4 + let main_sym call intern main_b let var_b call make_blob var_str 3 let var call intern var_b let section_b call make_blob section_str 7 @@ -57,7 +76,7 @@ function argc argv let return_b call make_blob return_str 6 let return call intern return_b - let code_items auto-words 3 + let code_items auto-words 5 set-word code_items 0 function set-word code_items 1 answer @@ -74,6 +93,26 @@ function argc argv set code call array 3 code_items call voodoo_translator_translate voodoo code + set-word items 0 call + set-word items 1 answer + set stmt call array 2 items + + set-word items 0 if + set-word items 1 argc_sym + set-word items 2 stmt + set stmt call array 3 items + set-word items 0 stmt + set stmt call array 1 items + set stmt call block stmt + + set-word code_items 0 function + set-word code_items 1 main_sym + set-word code_items 2 argc_sym + set-word code_items 3 argv_sym + set-word code_items 4 stmt + set code call array 5 code_items + call voodoo_translator_translate voodoo code + let stream standard_output call voodoo_translator_write voodoo stream -- 2.11.4.GIT