Skip to content

Commit ee78845

Browse files
committed
add tests for mssql small int decoding
tests #23
1 parent d5ed627 commit ee78845

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/mssql/types.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,44 @@ test_type!(i8(
3737
"CAST(0 AS TINYINT)" == 0_i8
3838
));
3939

40+
test_type!(u8_edge_cases<u8>(
41+
Mssql,
42+
"CAST(0 AS TINYINT)" == 0_u8,
43+
"CAST(127 AS TINYINT)" == 127_u8,
44+
"CAST(128 AS TINYINT)" == 128_u8,
45+
"CAST(255 AS TINYINT)" == 255_u8,
46+
));
47+
4048
test_type!(i16(Mssql, "CAST(21415 AS SMALLINT)" == 21415_i16));
4149

50+
test_type!(i16_edge_cases<i16>(
51+
Mssql,
52+
"CAST(-32768 AS SMALLINT)" == -32768_i16,
53+
"CAST(-1 AS SMALLINT)" == -1_i16,
54+
"CAST(0 AS SMALLINT)" == 0_i16,
55+
"CAST(32767 AS SMALLINT)" == 32767_i16,
56+
));
57+
4258
test_type!(i32(Mssql, "CAST(2141512 AS INT)" == 2141512_i32));
4359

60+
test_type!(i32_edge_cases<i32>(
61+
Mssql,
62+
"CAST(-2147483648 AS INT)" == -2147483648_i32,
63+
"CAST(-1 AS INT)" == -1_i32,
64+
"CAST(0 AS INT)" == 0_i32,
65+
"CAST(2147483647 AS INT)" == 2147483647_i32,
66+
));
67+
4468
test_type!(i64(Mssql, "CAST(32324324432 AS BIGINT)" == 32324324432_i64));
4569

70+
test_type!(i64_edge_cases<i64>(
71+
Mssql,
72+
"CAST(-9223372036854775808 AS BIGINT)" == -9223372036854775808_i64,
73+
"CAST(-1 AS BIGINT)" == -1_i64,
74+
"CAST(0 AS BIGINT)" == 0_i64,
75+
"CAST(9223372036854775807 AS BIGINT)" == 9223372036854775807_i64,
76+
));
77+
4678
test_type!(f32(
4779
Mssql,
4880
"CAST(3.14159265358979323846264338327950288 AS REAL)" == f32::consts::PI,

0 commit comments

Comments
 (0)