Skip to content

Commit d0c33ea

Browse files
committed
Skip some 64bit tests on 32bit platforms
1 parent 9efaa01 commit d0c33ea

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

t/moar/13-writeint.t

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,50 @@ is(buf_dump($buf), '0x00 0x80 0x00 0x00 0x00', 'nqp::writeuint - 32bit big endia
5858
# work around NQP's literals defaulting to num
5959
my uint64 $val := nqp::bitor_i(nqp::bitshiftl_i(0x01234567, 32), 0x89ABCDEF);
6060
$buf := Buffer.new;
61-
nqp::writeuint($buf, 1, $val, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_64_BIT);
61+
62+
if nqp::backendconfig(){"intvalsize"} < 8 {
63+
nqp::writeuint($buf, 1, 0x89ABCDEF, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_32_BIT);
64+
nqp::writeuint($buf, 5, 0x01234567, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_32_BIT);
65+
}
66+
else {
67+
nqp::writeuint($buf, 1, $val, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_64_BIT);
68+
}
6269

6370
is(buf_dump($buf), '0x00 0xEF 0xCD 0xAB 0x89 0x67 0x45 0x23 0x01', 'nqp::writeuint with 64bit little endian');
6471

6572
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_LITTLE), 0xEF, 'read byte');
6673
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_16_BIT), 0xCDEF, 'read word');
6774
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_32_BIT), 0x89ABCDEF, 'read dword');
68-
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_64_BIT), $val, 'read qword');
75+
76+
77+
if nqp::backendconfig(){"intvalsize"} < 8 {
78+
skip('nqp::readuint with 64bit not supported on <64bit platforms');
79+
} else {
80+
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_LITTLE +| nqp::const::BINARY_SIZE_64_BIT), $val, 'read qword');
81+
}
6982

7083
is(nqp::elems($buf), 9, 'nqp::readuint does not change the size of buffer');
7184

7285
$buf := Buffer.new;
73-
nqp::writeuint($buf, 1, $val, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_64_BIT);
86+
87+
if nqp::backendconfig(){"intvalsize"} < 8 {
88+
nqp::writeuint($buf, 1, 0x01234567, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_32_BIT);
89+
nqp::writeuint($buf, 5, 0x89ABCDEF, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_32_BIT);
90+
}
91+
else {
92+
nqp::writeuint($buf, 1, $val, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_64_BIT);
93+
}
7494

7595
is(buf_dump($buf), '0x00 0x01 0x23 0x45 0x67 0x89 0xAB 0xCD 0xEF', 'nqp::writeuint with 64bit big endian');
7696

7797
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_BIG), 0x01, 'read big endian byte');
7898
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_16_BIT), 0x0123, 'read big endian word');
7999
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_32_BIT), 0x01234567, 'read big endian dword');
80-
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_64_BIT), $val, 'read big endian qword');
100+
if nqp::backendconfig(){"intvalsize"} < 8 {
101+
skip('nqp::readuint with 64bit not supported on <64bit platforms');
102+
} else {
103+
is(nqp::readuint($buf, 1, nqp::const::BINARY_ENDIAN_BIG +| nqp::const::BINARY_SIZE_64_BIT), $val, 'read big endian qword');
104+
}
81105
is(nqp::elems($buf), 9, 'nqp::readuint does not change the size of buffer');
82106

83107
$buf := Buffer.new;

0 commit comments

Comments
 (0)