Skip to content

Commit 6618aad

Browse files
committed
Update unit test cases
1 parent 767d067 commit 6618aad

File tree

2 files changed

+63
-47
lines changed

2 files changed

+63
-47
lines changed

Diff for: src/test/java/com/exxeleron/qjava/QExpressions.java

+32-25
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ private void initExpressions() throws QException {
3535
reference.put("1+`", new QException("type"));
3636
reference.put("()", new Object[0]);
3737
reference.put("::", null);
38-
reference.put("1", 1);
38+
reference.put("1", 1L);
3939
reference.put("1i", 1);
4040
reference.put("-234h", (short) -234);
4141
reference.put("1b", true);
@@ -61,7 +61,7 @@ private void initExpressions() throws QException {
6161
reference.put("0b", QType.getQNull(QType.BOOL));
6262
reference.put("0x00", QType.getQNull(QType.BYTE));
6363
reference.put("0Nh", QType.getQNull(QType.SHORT));
64-
reference.put("0N", QType.getQNull(QType.INT));
64+
reference.put("0N", QType.getQNull(QType.LONG));
6565
reference.put("0Ni", QType.getQNull(QType.INT));
6666
reference.put("0Nj", QType.getQNull(QType.LONG));
6767
reference.put("0Ne", QType.getQNull(QType.FLOAT));
@@ -82,8 +82,8 @@ private void initExpressions() throws QException {
8282
referenceSerializationAlt.put("(0x01;0x02;0xff)", new Byte[] { 1, 2, (byte) 255 });
8383
reference.put("(1h;2h;3h)", new short[] { 1, 2, 3 });
8484
referenceSerializationAlt.put("(1h;2h;3h)", new Short[] { 1, 2, 3 });
85-
reference.put("1 2 3", new int[] { 1, 2, 3 });
86-
referenceSerializationAlt.put("1 2 3", new Integer[] { 1, 2, 3 });
85+
reference.put("1 2 3", new long[] { 1, 2, 3 });
86+
referenceSerializationAlt.put("1 2 3", new Long[] { 1L, 2L, 3L });
8787
reference.put("(1i;2i;3i)", new int[] { 1, 2, 3 });
8888
referenceSerializationAlt.put("(1i;2i;3i)", new Integer[] { 1, 2, 3 });
8989
reference.put("(1j;2j;3j)", new long[] { 1, 2, 3 });
@@ -92,9 +92,12 @@ private void initExpressions() throws QException {
9292
referenceSerializationAlt.put("(5.5e; 8.5e)", new Float[] { 5.5f, 8.5f });
9393
reference.put("3.23 6.46", new double[] { 3.23, 6.46 });
9494
referenceSerializationAlt.put("3.23 6.46", new Double[] { 3.23, 6.46 });
95-
reference.put("(1;`bcd;\"0bc\";5.5e)", new Object[] { 1, "bcd", "0bc".toCharArray(), (float) 5.5 });
96-
reference.put("(enlist 1h; 2; enlist 3j)", new Object[] { new short[] { 1 }, 2, new long[] { 3 } });
95+
reference.put("(1;`bcd;\"0bc\";5.5e)", new Object[] { 1L, "bcd", "0bc".toCharArray(), (float) 5.5 });
96+
reference.put("(enlist 1h; 2; enlist 3j)", new Object[] { new short[] { 1 }, 2L, new long[] { 3 } });
9797
reference.put("`the`quick`brown`fox", new String[] { "the", "quick", "brown", "fox" });
98+
reference.put("``quick``fox", new String[] { "", "quick", "", "fox" });
99+
reference.put("``", new String[] { "", "" });
100+
reference.put("(\"quick\"; \"brown\"; \"fox\"; \"jumps\"; \"over\"; \"a lazy\"; \"dog\")", new Object[] {"quick".toCharArray(), "brown".toCharArray(), "fox".toCharArray(), "jumps".toCharArray(), "over".toCharArray(), "a lazy".toCharArray(), "dog".toCharArray() });
98101
reference.put("2000.01.04D05:36:57.600 0Np", new QTimestamp[] { new QTimestamp(279417600000000L), new QTimestamp(Long.MIN_VALUE) });
99102
reference.put("(2001.01m; 0Nm)", new QMonth[] { new QMonth(12), new QMonth(Integer.MIN_VALUE) });
100103
reference.put("2001.01.01 2000.05.01 0Nd", new QDate[] { new QDate(366), new QDate(121), new QDate(Integer.MIN_VALUE) });
@@ -103,40 +106,44 @@ private void initExpressions() throws QException {
103106
reference.put("12:01 0Nu", new QMinute[] { new QMinute(721), new QMinute(Integer.MIN_VALUE) });
104107
reference.put("12:05:00 0Nv", new QSecond[] { new QSecond(43500), new QSecond(Integer.MIN_VALUE) });
105108
reference.put("12:04:59.123 0Nt", new QTime[] { new QTime(43499123), new QTime(Integer.MIN_VALUE) });
106-
reference.put("(enlist `a)!(enlist 1)", new QDictionary(new String[] { "a" }, new int[] { 1 }));
107-
reference.put("1 2!`abc`cdefgh", new QDictionary(new int[] { 1, 2 }, new String[] { "abc", "cdefgh" }));
109+
reference.put("(enlist `a)!(enlist 1)", new QDictionary(new String[] { "a" }, new long[] { 1 }));
110+
reference.put("1 2!`abc`cdefgh", new QDictionary(new long[] { 1, 2 }, new String[] { "abc", "cdefgh" }));
111+
reference.put("(`x`y!(`a;2))", new QDictionary(new String[] { "x", "y" }, new Object[] { "a", 2L }));
108112
reference.put("`abc`def`gh!([] one: 1 2 3; two: 4 5 6)", new QDictionary(new String[] { "abc", "def", "gh" }, new QTable(new String[] { "one", "two" },
109113
new Object[] { new long[] { 1, 2, 3 }, new long[] { 4, 5, 6 } })));
110-
reference.put("(1;2h;3.3;\"4\")!(`one;2 3;\"456\";(7;8 9))", new QDictionary(new Object[] { 1, (short) 2, 3.3, '4' },
111-
new Object[] { "one", new int[] { 2, 3 }, "456".toCharArray(), new Object[] { 7, new int[] { 8, 9 } } }));
112-
reference.put("(0 1; 2 3)!`first`second", new QDictionary(new Object[] { new int[] { 0, 1 }, new int[] { 2, 3 } }, new String[] { "first", "second" }));
114+
reference.put("(1;2h;3.3;\"4\")!(`one;2 3;\"456\";(7;8 9))", new QDictionary(new Object[] { 1L, (short) 2, 3.3, '4' },
115+
new Object[] { "one", new long[] { 2, 3 }, "456".toCharArray(), new Object[] { 7L, new long[] { 8, 9 } } }));
116+
reference.put("(0 1; 2 3)!`first`second", new QDictionary(new Object[] { new long[] { 0, 1 }, new long[] { 2, 3 } }, new String[] { "first", "second" }));
113117
reference.put("`A`B`C!((1;2.2;3);(`x`y!(`a;2));5.5)", new QDictionary(new String[] { "A", "B", "C" }, new Object[] {
114-
new Object[] { 1, 2.2, 3 },
118+
new Object[] { 1L, 2.2, 3L },
115119
new QDictionary(
116120
new String[] { "x", "y" },
117-
new Object[] { "a", 2 }),
121+
new Object[] { "a", 2L }),
118122
5.5 }));
119-
reference.put("flip `abc`def!(1 2 3; 4 5 6)", new QTable(new String[] { "abc", "def" }, new Object[] { new int[] { 1, 2, 3 }, new int[] { 4, 5, 6 } }));
123+
reference.put("flip `abc`def!(1 2 3; 4 5 6)", new QTable(new String[] { "abc", "def" }, new Object[] { new long[] { 1, 2, 3 }, new long[] { 4, 5, 6 } }));
120124
reference.put("flip `name`iq!(`Dent`Beeblebrox`Prefect;98 42 126)",
121-
new QTable(new String[] { "name", "iq" }, new Object[] { new String[] { "Dent", "Beeblebrox", "Prefect" }, new int[] { 98, 42, 126 } }));
125+
new QTable(new String[] { "name", "iq" }, new Object[] { new String[] { "Dent", "Beeblebrox", "Prefect" }, new long[] { 98, 42, 126 } }));
126+
reference.put("flip `name`iq`grade!(`Dent`Beeblebrox`Prefect;98 42 126;\"a c\")",
127+
new QTable(new String[] { "name", "iq", "grade" }, new Object[] { new String[] { "Dent", "Beeblebrox", "Prefect" }, new long[] { 98, 42, 126 }, new char[]{'a', ' ', 'c' }}));
128+
reference.put("flip `name`iq`fullname!(`Dent`Beeblebrox`Prefect;98 42 126;(\"Arthur Dent\"; \"Zaphod Beeblebrox\"; \"Ford Prefect\"))",
129+
new QTable(new String[] { "name", "iq", "fullname" }, new Object[] { new String[] { "Dent", "Beeblebrox", "Prefect" }, new long[] { 98, 42, 126 }, new Object[]{"Arthur Dent".toCharArray(), "Zaphod Beeblebrox".toCharArray(), "Ford Prefect".toCharArray()} }));
122130
reference.put("([] sc:1 2 3; nsc:(1 2; 3 4; 5 6 7))", new QTable(new String[] { "sc", "nsc" }, new Object[] {
123-
new int[] { 1, 2, 3 },
124-
new Object[] { new int[] { 1, 2 },
125-
new int[] { 3, 4 },
126-
new int[] { 5, 6, 7 } } }));
131+
new long[] { 1, 2, 3 },
132+
new Object[] { new long[] { 1, 2 },
133+
new long[] { 3, 4 },
134+
new long[] { 5, 6, 7 } } }));
127135
reference.put("([] name:`symbol$(); iq:`int$())", new QTable(new String[] { "name", "iq" }, new Object[] { new String[] {}, new int[] {} }));
128136
reference.put("([] pos:`d1`d2`d3;dates:(2001.01.01;2000.05.01;0Nd))", new QTable(new String[] { "pos", "dates" },
129137
new Object[] { new String[] { "d1", "d2", "d3" }, new QDate[] { new QDate(366), new QDate(121), new QDate(Integer.MIN_VALUE) } }));
130138
reference.put("([eid:1001 1002 1003] pos:`d1`d2`d3;dates:(2001.01.01;2000.05.01;0Nd))", new QKeyedTable(new QTable(new String[] { "eid" },
131-
new Object[] { new int[] { 1001, 1002, 1003 } }), new QTable(new String[] { "pos", "dates" },
139+
new Object[] { new long[] { 1001, 1002, 1003 } }), new QTable(new String[] { "pos", "dates" },
132140
new Object[] { new String[] { "d1", "d2", "d3" }, new QDate[] { new QDate(366), new QDate(121), new QDate(Integer.MIN_VALUE) } })));
133141
reference.put("{x+y}", new QLambda("{x+y}"));
134-
reference.put("{x+y}[3]", new QLambda("{x+y}", new Object[] { 3 }));
142+
reference.put("{x+y}[3]", new QLambda("{x+y}", new Object[] { 3L }));
135143
reference.put("0Ng", new UUID(0, 0));
136-
reference.put("\"G\"$\"0162fca8-c01f-7450-208c-55a06b2f2c54\"", new UUID(99919943463564368L, 2345343653434567764L));
137-
reference.put("\"G\"$\"00000000-0000-0000-0000-000000000000\"", new UUID(0, 0));
138-
reference.put("(\"G\"$\"0162fca8-c01f-7450-208c-55a06b2f2c54\"; 0Ng)",
139-
new UUID[] { new UUID(99919943463564368L, 2345343653434567764L), new UUID(0, 0) });
144+
reference.put("\"G\"$\"8c680a01-5a49-5aab-5a65-d4bfddb6a661\"", UUID.fromString("8c680a01-5a49-5aab-5a65-d4bfddb6a661"));
145+
reference.put("(\"G\"$\"8c680a01-5a49-5aab-5a65-d4bfddb6a661\"; 0Ng)",
146+
new UUID[] { UUID.fromString("8c680a01-5a49-5aab-5a65-d4bfddb6a661"), new UUID(0, 0) });
140147

141148
}
142149

Diff for: src/test/resources/QExpressions.out

+31-22
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
1+`
22
807479706500
33
1
4-
FA01000000
4+
F90100000000000000
55
1i
66
FA01000000
77
-234h
@@ -53,7 +53,7 @@ FC00
5353
0Nh
5454
FB0080
5555
0N
56-
FA00000080
56+
F90000000000000080
5757
0Ni
5858
FA00000080
5959
0Nj
@@ -91,7 +91,7 @@ ED00000080
9191
(1h;2h;3h)
9292
050003000000010002000300
9393
1 2 3
94-
060003000000010000000200000003000000
94+
070003000000010000000000000002000000000000000300000000000000
9595
(1i;2i;3i)
9696
060003000000010000000200000003000000
9797
(1j;2j;3j)
@@ -101,11 +101,17 @@ ED00000080
101101
3.23 6.46
102102
090002000000D7A3703D0AD70940D7A3703D0AD71940
103103
(1;`bcd;"0bc";5.5e)
104-
000004000000FA01000000F5626364000A0003000000306263F80000B040
104+
000004000000F90100000000000000F5626364000A0003000000306263F80000B040
105105
(enlist 1h; 2; enlist 3j)
106-
0000030000000500010000000100FA020000000700010000000300000000000000
106+
0000030000000500010000000100F902000000000000000700010000000300000000000000
107107
`the`quick`brown`fox
108108
0B000400000074686500717569636B0062726F776E00666F7800
109+
``quick``fox
110+
0B000400000000717569636B0000666F7800
111+
``
112+
0B00020000000000
113+
("quick"; "brown"; "fox"; "jumps"; "over"; "a lazy"; "dog")
114+
0000070000000A0005000000717569636B0A000500000062726F776E0A0003000000666F780A00050000006A756D70730A00040000006F7665720A000600000061206C617A790A0003000000646F67
109115
2000.01.04D05:36:57.600 0Np
110116
0C000200000000C0CAFA20FE00000000000000000080
111117
(2001.01m; 0Nm)
@@ -127,37 +133,40 @@ ED00000080
127133
{x+y}
128134
64000A00050000007B782B797D
129135
{x+y}[3]
130-
680200000064000A00050000007B782B797DFA03000000
136+
680200000064000A00050000007B782B797DF90300000000000000
131137
(enlist `a)!(enlist 1)
132-
630B0001000000610006000100000001000000
138+
630B000100000061000700010000000100000000000000
133139
1 2!`abc`cdefgh
134-
6306000200000001000000020000000B00020000006162630063646566676800
140+
63070002000000010000000000000002000000000000000B00020000006162630063646566676800
135141
`abc`def`gh!([] one: 1 2 3; two: 4 5 6)
136142
630B000300000061626300646566006768006200630B00020000006F6E650074776F00000002000000070003000000010000000000000002000000000000000300000000000000070003000000040000000000000005000000000000000600000000000000
143+
(`x`y!(`a;2))
144+
630b000200000078007900000002000000f56100f90200000000000000
137145
(1;2h;3.3;"4")!(`one;2 3;"456";(7;8 9))
138-
63000004000000FA01000000FB0200F76666666666660A40F634000004000000F56F6E650006000200000002000000030000000A0003000000343536000002000000FA070000000600020000000800000009000000
146+
63000004000000F90100000000000000FB0200F76666666666660A40F634000004000000F56F6E6500070002000000020000000000000003000000000000000A0003000000343536000002000000F9070000000000000007000200000008000000000000000900000000000000
139147
(0 1; 2 3)!`first`second
140-
63000002000000060002000000000000000100000006000200000002000000030000000B00020000006669727374007365636F6E6400
148+
6300000200000007000200000000000000000000000100000000000000070002000000020000000000000003000000000000000B00020000006669727374007365636F6E6400
141149
`A`B`C!((1;2.2;3);(`x`y!(`a;2));5.5)
142-
630B0003000000410042004300000003000000000003000000FA01000000F79A99999999990140FA03000000630B000200000078007900000002000000F56100FA02000000F70000000000001640
150+
630B0003000000410042004300000003000000000003000000F90100000000000000F79A99999999990140F90300000000000000630B000200000078007900000002000000F56100F90200000000000000F70000000000001640
143151
flip `abc`def!(1 2 3; 4 5 6)
144-
6200630B00020000006162630064656600000002000000060003000000010000000200000003000000060003000000040000000500000006000000
152+
6200630B00020000006162630064656600000002000000070003000000010000000000000002000000000000000300000000000000070003000000040000000000000005000000000000000600000000000000
145153
flip `name`iq!(`Dent`Beeblebrox`Prefect;98 42 126)
146-
6200630B00020000006E616D65006971000000020000000B000300000044656E7400426565626C6562726F78005072656665637400060003000000620000002A0000007E000000
154+
6200630B00020000006E616D65006971000000020000000B000300000044656E7400426565626C6562726F7800507265666563740007000300000062000000000000002A000000000000007E00000000000000
155+
flip `name`iq`grade!(`Dent`Beeblebrox`Prefect;98 42 126;"a c")
156+
6200630B00030000006E616D65006971006772616465000000030000000B000300000044656E7400426565626C6562726F7800507265666563740007000300000062000000000000002A000000000000007E000000000000000A0003000000612063
157+
flip `name`iq`fullname!(`Dent`Beeblebrox`Prefect;98 42 126;("Arthur Dent"; "Zaphod Beeblebrox"; "Ford Prefect"))
158+
6200630B00030000006E616D650069710066756C6C6E616D65000000030000000B000300000044656E7400426565626C6562726F7800507265666563740007000300000062000000000000002A000000000000007E000000000000000000030000000A000B0000004172746875722044656E740A00110000005A6170686F6420426565626C6562726F780A000C000000466F72642050726566656374
147159
([] sc:1 2 3; nsc:(1 2; 3 4; 5 6 7))
148-
6200630B00020000007363006E73630000000200000006000300000001000000020000000300000000000300000006000200000001000000020000000600020000000300000004000000060003000000050000000600000007000000
160+
6200630B00020000007363006E7363000000020000000700030000000100000000000000020000000000000003000000000000000000030000000700020000000100000000000000020000000000000007000200000003000000000000000400000000000000070003000000050000000000000006000000000000000700000000000000
149161
([] name:`symbol$(); iq:`int$())
150162
6200630B00020000006E616D65006971000000020000000B0000000000060000000000
151163
([] pos:`d1`d2`d3;dates:(2001.01.01;2000.05.01;0Nd))
152164
6200630B0002000000706F73006461746573000000020000000B00030000006431006432006433000E00030000006E0100007900000000000080
153165
([eid:1001 1002 1003] pos:`d1`d2`d3;dates:(2001.01.01;2000.05.01;0Nd))
154-
636200630B000100000065696400000001000000060003000000E9030000EA030000EB0300006200630B0002000000706F73006461746573000000020000000B00030000006431006432006433000E00030000006E0100007900000000000080
166+
636200630B000100000065696400000001000000070003000000E903000000000000EA03000000000000EB030000000000006200630B0002000000706F73006461746573000000020000000B00030000006431006432006433000E00030000006E0100007900000000000080
155167
0Ng
156168
fe00000000000000000000000000000000
157-
"G"$"00000000-0000-0000-0000-000000000000"
158-
fe00000000000000000000000000000000
159-
"G"$"0162fca8-c01f-7450-208c-55a06b2f2c54"
160-
fe0162fca8c01f7450208c55a06b2f2c54
161-
("G"$"0162fca8-c01f-7450-208c-55a06b2f2c54"; 0Ng)
162-
0200020000000162fca8c01f7450208c55a06b2f2c5400000000000000000000000000000000
163-
169+
"G"$"8c680a01-5a49-5aab-5a65-d4bfddb6a661"
170+
FE8C680A015A495AAB5A65D4BFDDB6A661
171+
("G"$"8c680a01-5a49-5aab-5a65-d4bfddb6a661"; 0Ng)
172+
0200020000008C680A015A495AAB5A65D4BFDDB6A66100000000000000000000000000000000

0 commit comments

Comments
 (0)