summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-10-28 23:47:08 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-10-28 23:51:45 +0300
commitbfa1ed0ae9cb15b54b008431d122db3c22cd45eb (patch)
treeea24698428f61f3bc9f6dfe84141fa498669f97b
parentfa13a138ea493fed22c16f8b89af494b3449bee1 (diff)
downloadnasm-bfa1ed0ae9cb15b54b008431d122db3c22cd45eb.tar.gz
test: nasm-t -- Add UTF testcase
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--travis/test/utf-error.stderr18
-rw-r--r--travis/test/utf.asm80
-rw-r--r--travis/test/utf.bin.tbin0 -> 369 bytes
-rw-r--r--travis/test/utf.json20
4 files changed, 118 insertions, 0 deletions
diff --git a/travis/test/utf-error.stderr b/travis/test/utf-error.stderr
new file mode 100644
index 00000000..3f420e3b
--- /dev/null
+++ b/travis/test/utf-error.stderr
@@ -0,0 +1,18 @@
+./travis/test/utf.asm:63: error: __utf16__ must be followed by a string constant
+./travis/test/utf.asm:64: error: __utf16__ must be followed by a string constant
+./travis/test/utf.asm:65: error: unterminated __utf16__ function
+./travis/test/utf.asm:65: error: comma expected after operand 2
+./travis/test/utf.asm:66: error: unterminated __utf16__ function
+./travis/test/utf.asm:67: error: invalid string for transform
+./travis/test/utf.asm:69: error: __utf16le__ must be followed by a string constant
+./travis/test/utf.asm:70: error: __utf16le__ must be followed by a string constant
+./travis/test/utf.asm:71: error: unterminated __utf16le__ function
+./travis/test/utf.asm:71: error: comma expected after operand 2
+./travis/test/utf.asm:72: error: unterminated __utf16le__ function
+./travis/test/utf.asm:73: error: invalid string for transform
+./travis/test/utf.asm:75: error: __utf16be__ must be followed by a string constant
+./travis/test/utf.asm:76: error: __utf16be__ must be followed by a string constant
+./travis/test/utf.asm:77: error: unterminated __utf16be__ function
+./travis/test/utf.asm:77: error: comma expected after operand 2
+./travis/test/utf.asm:78: error: unterminated __utf16be__ function
+./travis/test/utf.asm:79: error: invalid string for transform
diff --git a/travis/test/utf.asm b/travis/test/utf.asm
new file mode 100644
index 00000000..5ff1e559
--- /dev/null
+++ b/travis/test/utf.asm
@@ -0,0 +1,80 @@
+%define u(x) __utf16__(x)
+%define w(x) __utf32__(x)
+%define ul(x) __utf16le__(x)
+%define wl(x) __utf32le__(x)
+%define ub(x) __utf16be__(x)
+%define wb(x) __utf32be__(x)
+
+ db `Test \u306a\U0001abcd\n`
+ dw u(`Test \u306a\U0001abcd\n`)
+ dd w(`Test \u306a\U0001abcd\n`)
+
+ db `\u306a`
+ db `\xe3\x81\xaa`
+
+ dw __utf16__ "Hello, World!"
+
+ nop
+
+ mov ax,u(`a`)
+ mov bx,u(`\u306a`)
+ mov cx,u(`\xe3\x81\xaa`)
+ mov eax,u(`ab`)
+ mov ebx,u(`\U0001abcd`)
+ mov ecx,w(`\U0001abcd`)
+
+ db `Test \u306a\U0001abcd\n`
+ dw ul(`Test \u306a\U0001abcd\n`)
+ dd wl(`Test \u306a\U0001abcd\n`)
+
+ db `\u306a`
+ db `\xe3\x81\xaa`
+
+ dw __utf16le__ "Hello, World!"
+
+ nop
+
+ mov ax,ul(`a`)
+ mov bx,ul(`\u306a`)
+ mov cx,ul(`\xe3\x81\xaa`)
+ mov eax,ul(`ab`)
+ mov ebx,ul(`\U0001abcd`)
+ mov ecx,wl(`\U0001abcd`)
+
+ db `Test \u306a\U0001abcd\n`
+ dw ub(`Test \u306a\U0001abcd\n`)
+ dd wb(`Test \u306a\U0001abcd\n`)
+
+ db `\u306a`
+ db `\xe3\x81\xaa`
+
+ dw __utf16be__ "Hello, World!"
+
+ nop
+
+ mov ax,ub(`a`)
+ mov bx,ub(`\u306a`)
+ mov cx,ub(`\xe3\x81\xaa`)
+ mov eax,ub(`ab`)
+ mov ebx,ub(`\U0001abcd`)
+ mov ecx,wb(`\U0001abcd`)
+
+%ifdef ERROR
+ dw __utf16__ 33
+ dw __utf16__, 46
+ dw __utf16__("Hello, World!",16)
+ dw __utf16__("Hello, World!",16
+ dw u(`\xff`)
+
+ dw __utf16le__ 33
+ dw __utf16le__, 46
+ dw __utf16le__("Hello, World!",16)
+ dw __utf16le__("Hello, World!",16
+ dw ul(`\xff`)
+
+ dw __utf16be__ 33
+ dw __utf16be__, 46
+ dw __utf16be__("Hello, World!",16)
+ dw __utf16be__("Hello, World!",16
+ dw ub(`\xff`)
+%endif
diff --git a/travis/test/utf.bin.t b/travis/test/utf.bin.t
new file mode 100644
index 00000000..a6c34215
--- /dev/null
+++ b/travis/test/utf.bin.t
Binary files differ
diff --git a/travis/test/utf.json b/travis/test/utf.json
new file mode 100644
index 00000000..c1126d89
--- /dev/null
+++ b/travis/test/utf.json
@@ -0,0 +1,20 @@
+[
+ {
+ "description": "Test __utf__ helpers",
+ "id": "utf",
+ "format": "bin",
+ "source": "utf.asm",
+ "target": [
+ { "output": "utf.bin" }
+ ]
+ },
+ {
+ "description": "Test errors in __utf__ helpers",
+ "ref": "utf",
+ "option": "-DERROR",
+ "target": [
+ { "stderr": "utf-error.stderr" }
+ ],
+ "error": "expected"
+ }
+]