mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-16 08:21:44 +00:00
Add test case for #26
This commit is contained in:
23
tests/compiler/overflow.ts
Normal file
23
tests/compiler/overflow.ts
Normal file
@ -0,0 +1,23 @@
|
||||
// see also: https://github.com/AssemblyScript/assemblyscript/issues/26
|
||||
|
||||
var badByte: u8 = 0xFF;
|
||||
badByte += 1;
|
||||
assert(badByte == 0);
|
||||
|
||||
var anotherBadByte: u8 = 0xFF;
|
||||
var badIncrementer: u8 = 1;
|
||||
anotherBadByte += badIncrementer;
|
||||
assert(anotherBadByte == 0);
|
||||
|
||||
function local(): void {
|
||||
var badByte: u8 = 0xFF;
|
||||
badByte += 1;
|
||||
assert(badByte == 0);
|
||||
|
||||
var anotherBadByte: u8 = 0xFF;
|
||||
var badIncrementer: u8 = 1;
|
||||
anotherBadByte += badIncrementer;
|
||||
assert(anotherBadByte == 0);
|
||||
}
|
||||
|
||||
local();
|
Reference in New Issue
Block a user