Update Stint in header + mention unsigned vs signed int in tests
This commit is contained in:
parent
0296b5eca9
commit
d690923310
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import ../src/stint, unittest
|
import ../src/stint, unittest
|
||||||
|
|
||||||
suite "Testing addition implementation":
|
suite "Testing unsigned int addition implementation":
|
||||||
test "In-place addition gives expected result":
|
test "In-place addition gives expected result":
|
||||||
|
|
||||||
var a = 20182018.stuint(64)
|
var a = 20182018.stuint(64)
|
||||||
|
@ -51,7 +51,7 @@ suite "Testing addition implementation":
|
||||||
z += a
|
z += a
|
||||||
check: cast[uint16](z) == 164
|
check: cast[uint16](z) == 164
|
||||||
|
|
||||||
suite "Testing substraction implementation":
|
suite "Testing unsigned int substraction implementation":
|
||||||
test "In-place substraction gives expected result":
|
test "In-place substraction gives expected result":
|
||||||
|
|
||||||
var a = 20182018.stuint(64)
|
var a = 20182018.stuint(64)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import ../src/stint, unittest
|
import ../src/stint, unittest
|
||||||
|
|
||||||
suite "Testing bitwise operations":
|
suite "Testing unsigned int bitwise operations":
|
||||||
let a = 100'i16.stuint(16)
|
let a = 100'i16.stuint(16)
|
||||||
|
|
||||||
let b = a * a
|
let b = a * a
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import ../src/stint, unittest
|
import ../src/stint, unittest
|
||||||
|
|
||||||
suite "Testing comparison operators":
|
suite "Testing unsigned int comparison operators":
|
||||||
let
|
let
|
||||||
a = 10'i16.stuint(16)
|
a = 10'i16.stuint(16)
|
||||||
b = 15'i16.stuint(16)
|
b = 15'i16.stuint(16)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import ../src/stint, unittest
|
import ../src/stint, unittest
|
||||||
|
|
||||||
suite "Testing byte representation":
|
suite "Testing unsigned int byte representation":
|
||||||
test "Byte representation conforms to the platform endianness":
|
test "Byte representation conforms to the platform endianness":
|
||||||
let a = 20182018.stuint(64)
|
let a = 20182018.stuint(64)
|
||||||
let b = 20182018'u64
|
let b = 20182018'u64
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Mpint
|
# Stint
|
||||||
# Copyright 2018 Status Research & Development GmbH
|
# Copyright 2018 Status Research & Development GmbH
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
#
|
#
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
import ../src/stint, unittest
|
import ../src/stint, unittest
|
||||||
|
|
||||||
suite "Testing multiplication implementation":
|
suite "Testing unsigned int multiplication implementation":
|
||||||
test "Multiplication with result fitting in low half":
|
test "Multiplication with result fitting in low half":
|
||||||
|
|
||||||
let a = 10000.stuint(64)
|
let a = 10000.stuint(64)
|
||||||
|
@ -33,7 +33,7 @@ suite "Testing multiplication implementation":
|
||||||
check: cast[uint64](a*b*c) == 1_000_000_000_000_000_000_000'u64 # need 70-bits
|
check: cast[uint64](a*b*c) == 1_000_000_000_000_000_000_000'u64 # need 70-bits
|
||||||
|
|
||||||
|
|
||||||
suite "Testing division and modulo implementation":
|
suite "Testing unsigned int division and modulo implementation":
|
||||||
test "Divmod(100, 13) returns the correct result":
|
test "Divmod(100, 13) returns the correct result":
|
||||||
|
|
||||||
let a = 100.stuint(64)
|
let a = 100.stuint(64)
|
||||||
|
|
Loading…
Reference in New Issue