mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
test sumComplement32
This commit is contained in:
committed by
David Lechner
parent
858cf26e5e
commit
ae21501aa2
@@ -1,4 +1,4 @@
|
||||
import { fmod } from './math';
|
||||
import { fmod, sumComplement32 } from './math';
|
||||
|
||||
test('fmod of positive numbers', () => {
|
||||
expect(fmod(3, 4)).toBe(3 % 4);
|
||||
@@ -7,3 +7,10 @@ test('fmod of positive numbers', () => {
|
||||
test('fmod of negative and positive number', () => {
|
||||
expect(fmod(-3, 4)).toBe(1);
|
||||
});
|
||||
|
||||
test('sumComplement32', () => {
|
||||
// basic test
|
||||
expect(sumComplement32([1, 2, 3, 4, 5])).toBe(-(1 + 2 + 3 + 4 + 5));
|
||||
// overflow
|
||||
expect(sumComplement32([0xffffffff, 0xffffffff])).toBe(-(-1 + -1));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user