From 561e46cb97c11d41f31a952ef64782f81bb16dc9 Mon Sep 17 00:00:00 2001 From: Golmote Date: Fri, 28 Aug 2015 08:34:10 +0200 Subject: [PATCH] Add tests for NASM --- tests/languages/nasm/comment_feature.test | 13 +++ tests/languages/nasm/keyword_feature.test | 30 +++++++ tests/languages/nasm/label_feature.test | 15 ++++ tests/languages/nasm/number_feature.test | 97 ++++++++++++++++++++++ tests/languages/nasm/operator_feature.test | 17 ++++ tests/languages/nasm/register_feature.test | 43 ++++++++++ tests/languages/nasm/string_feature.test | 21 +++++ 7 files changed, 236 insertions(+) create mode 100644 tests/languages/nasm/comment_feature.test create mode 100644 tests/languages/nasm/keyword_feature.test create mode 100644 tests/languages/nasm/label_feature.test create mode 100644 tests/languages/nasm/number_feature.test create mode 100644 tests/languages/nasm/operator_feature.test create mode 100644 tests/languages/nasm/register_feature.test create mode 100644 tests/languages/nasm/string_feature.test diff --git a/tests/languages/nasm/comment_feature.test b/tests/languages/nasm/comment_feature.test new file mode 100644 index 0000000000..44659860b3 --- /dev/null +++ b/tests/languages/nasm/comment_feature.test @@ -0,0 +1,13 @@ +; +; foo + +---------------------------------------------------- + +[ + ["comment", ";"], + ["comment", "; foo"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/tests/languages/nasm/keyword_feature.test b/tests/languages/nasm/keyword_feature.test new file mode 100644 index 0000000000..699387c02c --- /dev/null +++ b/tests/languages/nasm/keyword_feature.test @@ -0,0 +1,30 @@ +BITS 16 BITS 32 BITS 64 +[BITS 16] [BITS 32] [BITS 64] + +section Foo.bar +section foobar: + +extern _printf +global _main + +CPU 8086 +FLOAT DAZ +DEFAULT REL + +---------------------------------------------------- + +[ + ["keyword", "BITS 16"], ["keyword", "BITS 32"], ["keyword", "BITS 64"], + ["keyword", "[BITS 16]"], ["keyword", "[BITS 32]"], ["keyword", "[BITS 64]"], + ["keyword", "section Foo.bar"], + ["keyword", "section foobar:"], + ["keyword", "extern _printf"], + ["keyword", "global _main"], + ["keyword", "CPU 8086"], + ["keyword", "FLOAT DAZ"], + ["keyword", "DEFAULT REL"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/tests/languages/nasm/label_feature.test b/tests/languages/nasm/label_feature.test new file mode 100644 index 0000000000..e9be0d1956 --- /dev/null +++ b/tests/languages/nasm/label_feature.test @@ -0,0 +1,15 @@ +foo42: +.foo: +..@foo: + +---------------------------------------------------- + +[ + ["label", "foo42:"], + ["label", ".foo:"], + ["label", "..@foo:"] +] + +---------------------------------------------------- + +Checks for labels. \ No newline at end of file diff --git a/tests/languages/nasm/number_feature.test b/tests/languages/nasm/number_feature.test new file mode 100644 index 0000000000..6ffd995a1b --- /dev/null +++ b/tests/languages/nasm/number_feature.test @@ -0,0 +1,97 @@ +0xBadFace +0x4f.ab +0x4p2 +0x2.ap-8 +0x1p+1 + +0hBadFace +0h4f.ab +0h4p2 +0h2.ap-8 +0h1p+1 +42fh +4ab2x + +$4 +$2a4f + +0o75 +0q75 +75o +75q + +0b0101 +0y0101 +0101b +0101y + +0d42 +0t42 +42 +3.14159 +4.2e4 +2e-1 +3.1e+2 +42d +3.14159d +4.2e4d +2e-1d +3.1e+2d +42t +3.14159t +4.2e4t +2e-1t +3.1e+2t + +---------------------------------------------------- + +[ + ["number", "0xBadFace"], + ["number", "0x4f.ab"], + ["number", "0x4p2"], + ["number", "0x2.ap-8"], + ["number", "0x1p+1"], + + ["number", "0hBadFace"], + ["number", "0h4f.ab"], + ["number", "0h4p2"], + ["number", "0h2.ap-8"], + ["number", "0h1p+1"], + ["number", "42fh"], + ["number", "4ab2x"], + + ["number", "$4"], + ["number", "$2a4f"], + + ["number", "0o75"], + ["number", "0q75"], + ["number", "75o"], + ["number", "75q"], + + ["number", "0b0101"], + ["number", "0y0101"], + ["number", "0101b"], + ["number", "0101y"], + + ["number", "0d42"], + ["number", "0t42"], + ["number", "42"], + ["number", "3.14159"], + ["number", "4.2e4"], + ["number", "2e-1"], + ["number", "3.1e+2"], + ["number", "42d"], + ["number", "3.14159d"], + ["number", "4.2e4d"], + ["number", "2e-1d"], + ["number", "3.1e+2d"], + ["number", "42t"], + ["number", "3.14159t"], + ["number", "4.2e4t"], + ["number", "2e-1t"], + ["number", "3.1e+2t"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/tests/languages/nasm/operator_feature.test b/tests/languages/nasm/operator_feature.test new file mode 100644 index 0000000000..0202fc4a14 --- /dev/null +++ b/tests/languages/nasm/operator_feature.test @@ -0,0 +1,17 @@ +[ ] +* + - / +% < > = +& | $ ! + +---------------------------------------------------- + +[ + ["operator", "["], ["operator", "]"], + ["operator", "*"], ["operator", "+"], ["operator", "-"], ["operator", "/"], + ["operator", "%"], ["operator", "<"], ["operator", ">"], ["operator", "="], + ["operator", "&"], ["operator", "|"], ["operator", "$"], ["operator", "!"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/tests/languages/nasm/register_feature.test b/tests/languages/nasm/register_feature.test new file mode 100644 index 0000000000..77f054ec15 --- /dev/null +++ b/tests/languages/nasm/register_feature.test @@ -0,0 +1,43 @@ +st0 st1 +xmm1 xmm2 +ymm1 ymm2 +zmm1 zmm2 +cr1 dr1 tr1 +r1 r42 +r1b r1w r1d +ax bx cx dx +eax ebx ecx edx +rax rbx rcx rdx +ah bh ch dh +al bl cl dl +bp sp si di +ebp esp esi edi +rbp rsp rsi rdi +cs ds es +fs gs ss + +---------------------------------------------------- + +[ + ["register", "st0"], ["register", "st1"], + ["register", "xmm1"], ["register", "xmm2"], + ["register", "ymm1"], ["register", "ymm2"], + ["register", "zmm1"], ["register", "zmm2"], + ["register", "cr1"], ["register", "dr1"], ["register", "tr1"], + ["register", "r1"], ["register", "r42"], + ["register", "r1b"], ["register", "r1w"], ["register", "r1d"], + ["register", "ax"], ["register", "bx"], ["register", "cx"], ["register", "dx"], + ["register", "eax"], ["register", "ebx"], ["register", "ecx"], ["register", "edx"], + ["register", "rax"], ["register", "rbx"], ["register", "rcx"], ["register", "rdx"], + ["register", "ah"], ["register", "bh"], ["register", "ch"], ["register", "dh"], + ["register", "al"], ["register", "bl"], ["register", "cl"], ["register", "dl"], + ["register", "bp"], ["register", "sp"], ["register", "si"], ["register", "di"], + ["register", "ebp"], ["register", "esp"], ["register", "esi"], ["register", "edi"], + ["register", "rbp"], ["register", "rsp"], ["register", "rsi"], ["register", "rdi"], + ["register", "cs"], ["register", "ds"], ["register", "es"], + ["register", "fs"], ["register", "gs"], ["register", "ss"] +] + +---------------------------------------------------- + +Checks for registers. \ No newline at end of file diff --git a/tests/languages/nasm/string_feature.test b/tests/languages/nasm/string_feature.test new file mode 100644 index 0000000000..6cbc1ea97b --- /dev/null +++ b/tests/languages/nasm/string_feature.test @@ -0,0 +1,21 @@ +"" +"fo\"o" +'' +'fo\'o' +`` +`fo\`o` + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\""], + ["string", "''"], + ["string", "'fo\\'o'"], + ["string", "``"], + ["string", "`fo\\`o`"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file