replace x86.T with native.T
This commit is contained in:
parent
e29a5a3475
commit
f67f8c0118
12 changed files with 91 additions and 91 deletions
test
28
test/test.sh
28
test/test.sh
|
@ -34,50 +34,50 @@ Running test case ${TEST_NAME}"
|
|||
}
|
||||
|
||||
TEST_NAME=test-radix-convert
|
||||
SRC_TYPE="ℕ ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10> ~ Char ~ Ascii ~ x86.UInt8>"
|
||||
DST_TYPE="ℕ ~ <PosInt 16 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 16> ~ Char ~ Ascii ~ x86.UInt8>"
|
||||
SRC_TYPE="ℕ ~ <PosInt 10 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 10> ~ Char ~ Ascii ~ native.UInt8>"
|
||||
DST_TYPE="ℕ ~ <PosInt 16 BigEndian> ~ <Seq~<ValueTerminated 0> <Digit 16> ~ Char ~ Ascii ~ native.UInt8>"
|
||||
INPUT="255"
|
||||
EXPECT="ff"
|
||||
run_test_case
|
||||
|
||||
TEST_NAME=test-msb-cont
|
||||
SRC_TYPE="<Seq~<ValueTerminated 0> x86.UInt8>"
|
||||
DST_TYPE="<Seq~MsbCont x86.UInt8>"
|
||||
SRC_TYPE="<Seq~<ValueTerminated 0> native.UInt8>"
|
||||
DST_TYPE="<Seq~MsbCont native.UInt8>"
|
||||
INPUT=$(printf '\x01\x02\x03')
|
||||
EXPECT=$(printf '\x81\x82\x03')
|
||||
run_test_case
|
||||
|
||||
TEST_NAME=test-value-sep1
|
||||
SRC_TYPE="<Seq <Seq Char~x86.UInt8>> ~ <ValueSep ':' Char~x86.UInt8> ~ <Seq~<ValueTerminated 0> Char~x86.UInt8>"
|
||||
DST_TYPE="<Seq <Seq Char~x86.UInt8>> ~ <ValueSep ',' Char~x86.UInt8> ~ <Seq~<ValueTerminated 0> Char~x86.UInt8>"
|
||||
SRC_TYPE="<Seq <Seq Char~native.UInt8>> ~ <ValueSep ':' Char~native.UInt8> ~ <Seq~<ValueTerminated 0> Char~native.UInt8>"
|
||||
DST_TYPE="<Seq <Seq Char~native.UInt8>> ~ <ValueSep ',' Char~native.UInt8> ~ <Seq~<ValueTerminated 0> Char~native.UInt8>"
|
||||
INPUT="abc:def:hello world:test"
|
||||
EXPECT="abc,def,hello world,test"
|
||||
run_test_case
|
||||
|
||||
TEST_NAME=test-value-sep2
|
||||
SRC_TYPE="<Seq <Seq x86.UInt8>> ~ <ValueSep ':' x86.UInt8> ~ <Seq~<ValueTerminated 0> x86.UInt8>"
|
||||
DST_TYPE="<Seq <Seq x86.UInt8>> ~ <ValueSep '\\n' x86.UInt8> ~ <Seq~<ValueTerminated 0> x86.UInt8>"
|
||||
SRC_TYPE="<Seq <Seq native.UInt8>> ~ <ValueSep ':' native.UInt8> ~ <Seq~<ValueTerminated 0> native.UInt8>"
|
||||
DST_TYPE="<Seq <Seq native.UInt8>> ~ <ValueSep '\\n' native.UInt8> ~ <Seq~<ValueTerminated 0> native.UInt8>"
|
||||
INPUT="abc:def:hello world:test"
|
||||
EXPECT=$(echo -en "abc\ndef\nhello world\ntest")
|
||||
run_test_case
|
||||
|
||||
TEST_NAME=test-value-sep-digit
|
||||
SRC_TYPE="<Seq <Seq <Digit 16>~Char~Ascii~x86.UInt8>> ~ <ValueSep ':' Char~Ascii~x86.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~x86.UInt8>"
|
||||
DST_TYPE="<Seq <Seq <Digit 16>~Char~Ascii~x86.UInt8>> ~ <ValueSep '.' Char~Ascii~x86.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~x86.UInt8>"
|
||||
SRC_TYPE="<Seq <Seq <Digit 16>~Char~Ascii~native.UInt8>> ~ <ValueSep ':' Char~Ascii~native.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~native.UInt8>"
|
||||
DST_TYPE="<Seq <Seq <Digit 16>~Char~Ascii~native.UInt8>> ~ <ValueSep '.' Char~Ascii~native.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~native.UInt8>"
|
||||
INPUT="c0:ff:ee"
|
||||
EXPECT=$(echo -en "c0.ff.ee")
|
||||
run_test_case
|
||||
|
||||
TEST_NAME=test-utf8-to-ascii
|
||||
SRC_TYPE="<Seq Char~Unicode> ~ UTF-8 ~ <Seq ~ <ValueTerminated 0> x86.UInt8>"
|
||||
DST_TYPE="<Seq~<ValueTerminated 0> Char ~ Ascii ~ x86.UInt8>"
|
||||
SRC_TYPE="<Seq Char~Unicode> ~ UTF-8 ~ <Seq ~ <ValueTerminated 0> native.UInt8>"
|
||||
DST_TYPE="<Seq~<ValueTerminated 0> Char ~ Ascii ~ native.UInt8>"
|
||||
INPUT="Hℵelαlo WΓΓΓorl⇒d"
|
||||
EXPECT="Hello World"
|
||||
run_test_case
|
||||
|
||||
TEST_NAME=test-value-sep-posint
|
||||
SRC_TYPE="<Seq ℕ~<PosInt 16 BigEndian>~<Seq <Digit 16>~Char~Ascii~x86.UInt8>> ~ <ValueSep ':' Char~Ascii~x86.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~x86.UInt8>"
|
||||
DST_TYPE="<Seq ℕ~<PosInt 16 BigEndian>~<Seq <Digit 16>~Char~Ascii~x86.UInt8>> ~ <ValueSep '.' Char~Ascii~x86.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~x86.UInt8>"
|
||||
SRC_TYPE="<Seq ℕ~<PosInt 16 BigEndian>~<Seq <Digit 16>~Char~Ascii~native.UInt8>> ~ <ValueSep ':' Char~Ascii~native.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~native.UInt8>"
|
||||
DST_TYPE="<Seq ℕ~<PosInt 16 BigEndian>~<Seq <Digit 16>~Char~Ascii~native.UInt8>> ~ <ValueSep '.' Char~Ascii~native.UInt8> ~ <Seq~<ValueTerminated '\0'> Char~Ascii~native.UInt8>"
|
||||
INPUT="c0:ff:ee"
|
||||
EXPECT=$(echo -en "c0.ff.ee")
|
||||
run_test_case
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue