Moved eel and eapml under the contrib folder.
This commit is contained in:
37
contrib/ise_library/math/eapml/tests/TODO.txt
Normal file
37
contrib/ise_library/math/eapml/tests/TODO.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
Test suite order -
|
||||
|
||||
-Interfaces must be tested first (string conversions, Eiffel native construction conversions, etc, using known good large numbers verified by other big number libraries.
|
||||
(If we don't have at least this then nothing else can be trusted)
|
||||
|
||||
-Integer Interfaces
|
||||
-Real Interfaces
|
||||
* Real MPF
|
||||
* Real MPFR
|
||||
-Rational
|
||||
-Complex Integer
|
||||
-Complex Complex Real
|
||||
* Complex Real MPF
|
||||
* Complex Real MPFR
|
||||
-Complex Rational
|
||||
|
||||
|
||||
|
||||
-Test arithmetic functions for each eiffel MP constrcts using known values/solutions for "big" numbers and checking using previously tested known-good interfaces.
|
||||
|
||||
*Test arithmetic operations between similar types of MP constructs
|
||||
*Test arithmetic operations between different types of MP constructs
|
||||
|
||||
|
||||
TODO:
|
||||
Reformat test suite order
|
||||
Start testing interfaces
|
||||
-Integer Interfaces
|
||||
-Real Interfaces
|
||||
* Real MPF
|
||||
* Real MPFR
|
||||
-Rational
|
||||
-Complex Integer
|
||||
-Complex Complex Real
|
||||
* Complex Real MPF
|
||||
* Complex Real MPFR
|
||||
-Complex Rational
|
||||
43
contrib/ise_library/math/eapml/tests/test.e
Normal file
43
contrib/ise_library/math/eapml/tests/test.e
Normal file
@@ -0,0 +1,43 @@
|
||||
note
|
||||
description : "Library unit test root class"
|
||||
date : "$Date: 2008-12-29 15:41:59 -0800 (Mon, 29 Dec 2008) $"
|
||||
revision : "$Revision: 76432 $"
|
||||
|
||||
class
|
||||
TEST
|
||||
|
||||
inherit
|
||||
ARGUMENTS
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
local
|
||||
do
|
||||
end
|
||||
|
||||
test1: detachable TEST_INTEGER_X
|
||||
test2: detachable TEST_INTEGER_FUNCTIONS
|
||||
test3: detachable TEST_INTEGER_X_ASSIGNMENT
|
||||
test4: detachable TEST_SPECIAL_ARITHMETIC
|
||||
test5: detachable TEST_SPECIAL_DIVISION
|
||||
test6: detachable TEST_SPECIAL_LOGIC
|
||||
test7: detachable TEST_SPECIAL_NUMBER_THEORETIC
|
||||
test9: detachable TEST_RANDSTRUCT_LC
|
||||
test10: detachable TEST_RANDSTRUCT_MT
|
||||
test11: detachable TEST_INTEGER_X_RANDOM
|
||||
test12: detachable TEST_INTEGER_X_ACCESS
|
||||
test13: detachable TEST_INTEGER_X_IO
|
||||
test14: detachable TEST_INTEGER_X_NUMBER_THEORY
|
||||
test15: detachable TEST_INTEGER_X_ARITHMETIC
|
||||
test16: detachable TEST_SPECIAL_GCD
|
||||
test17: detachable TEST_INTEGER_X_DIVISION
|
||||
test18: detachable TEST_INTEGER_X_GCD
|
||||
test19: detachable TEST_INTEGER_X_LOGIC
|
||||
test20: detachable TEST_LIMB_MANIPULATION
|
||||
test21: detachable IMMUTABLE_INTEGER_X
|
||||
test22: detachable INTEGER_X
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
note
|
||||
description: "[
|
||||
Eiffel tests that can be executed by testing tool.
|
||||
]"
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
testing: "type/manual"
|
||||
|
||||
class
|
||||
TEST_INTEGER_FUNCTIONS
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
feature -- Test routines
|
||||
end
|
||||
|
||||
|
||||
557
contrib/ise_library/math/eapml/tests/test_integer_x.e
Normal file
557
contrib/ise_library/math/eapml/tests/test_integer_x.e
Normal file
@@ -0,0 +1,557 @@
|
||||
note
|
||||
description: "[
|
||||
Eiffel tests that can be executed by testing tool.
|
||||
]"
|
||||
author: "EiffelStudio test wizard"
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
testing: "type/manual"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_ASSIGNMENT
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature -- Basic operations tests
|
||||
test_init
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one
|
||||
end
|
||||
|
||||
test_default_zero
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one
|
||||
assert ("{INTEGER_X}.default_create", one.to_integer_32 = 0)
|
||||
end
|
||||
|
||||
test_make_ui
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_natural (0xffffffff)
|
||||
assert ("{INTEGER_X}.make_ui", one.to_natural_32 = 0xffffffff)
|
||||
end
|
||||
|
||||
test_as_natural
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_natural (0xffffffff)
|
||||
assert ("{INTEGER_X}.as_natural", one.to_natural_32 = 0xffffffff)
|
||||
end
|
||||
|
||||
test_make_si
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0x7fffffff)
|
||||
assert ("{INTEGER_X}.make_si", one.to_integer_32 = 0x7fffffff)
|
||||
end
|
||||
|
||||
test_as_integer
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0x7fffffff)
|
||||
assert ("{INTEGER_X}.as_integer", one.to_integer_32 = 0x7fffffff)
|
||||
end
|
||||
|
||||
test_fits_natural_8_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_8
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits natural 8 1", one.fits_natural_8)
|
||||
end
|
||||
|
||||
test_fits_natural_8_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_8
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits natural 8 2", not one.fits_natural_8)
|
||||
end
|
||||
|
||||
test_fits_natural_8_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits natural 8 3", one.fits_natural_8)
|
||||
end
|
||||
|
||||
test_fits_natural_8_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (-1)
|
||||
assert ("test fits natural 8 4", not one.fits_natural_8)
|
||||
end
|
||||
|
||||
test_fits_natural_16_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_16
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits natural 16 1", one.fits_natural_16)
|
||||
end
|
||||
|
||||
test_fits_natural_16_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_16
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits natural 16 2", not one.fits_natural_16)
|
||||
end
|
||||
|
||||
test_fits_natural_16_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits natural 16 3", one.fits_natural_16)
|
||||
end
|
||||
|
||||
test_fits_natural_16_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (-1)
|
||||
assert ("test fits natural 16 4", not one.fits_natural_16)
|
||||
end
|
||||
|
||||
test_fits_natural_32_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_32
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits natural 32 1", one.fits_natural_32)
|
||||
end
|
||||
|
||||
test_fits_natural_32_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_32
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits natural 32 2", not one.fits_natural_32)
|
||||
end
|
||||
|
||||
test_fits_natural_32_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits natural 32 3", one.fits_natural_32)
|
||||
end
|
||||
|
||||
test_fits_natural_32_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (-1)
|
||||
assert ("test fits natural 32 4", not one.fits_natural_32)
|
||||
end
|
||||
|
||||
test_fits_natural_64_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_64
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits natural 64 1", one.fits_natural_64)
|
||||
end
|
||||
|
||||
test_fits_natural_64_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: NATURAL_64
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits natural 64 2", not one.fits_natural_64)
|
||||
end
|
||||
|
||||
test_fits_natural_64_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits natural 64 3", one.fits_natural_64)
|
||||
end
|
||||
|
||||
test_fits_natural_64_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (-1)
|
||||
assert ("test fits natural 64 4", not one.fits_natural_64)
|
||||
end
|
||||
|
||||
test_fits_integer_8_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits integer 8 1", one.fits_integer_8)
|
||||
end
|
||||
|
||||
test_fits_integer_8_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test fits integer 8 2", one.fits_integer_8)
|
||||
end
|
||||
|
||||
test_fits_integer_8_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits integer 8 3", not one.fits_integer_8)
|
||||
end
|
||||
|
||||
test_fits_integer_8_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test fits integer 8 4", not one.fits_integer_8)
|
||||
end
|
||||
|
||||
test_fits_integer_8_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits integer 8 5", one.fits_integer_8)
|
||||
end
|
||||
|
||||
test_fits_integer_16_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits integer 16 1", one.fits_integer_16)
|
||||
end
|
||||
|
||||
test_fits_integer_16_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test fits integer 16 2", one.fits_integer_16)
|
||||
end
|
||||
|
||||
test_fits_integer_16_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits integer 16 3", not one.fits_integer_16)
|
||||
end
|
||||
|
||||
test_fits_integer_16_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test fits integer 16 4", not one.fits_integer_16)
|
||||
end
|
||||
|
||||
test_fits_integer_16_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits integer 16 5", one.fits_integer_16)
|
||||
end
|
||||
|
||||
test_fits_integer_32_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits integer 32 1", one.fits_integer_32)
|
||||
end
|
||||
|
||||
test_fits_integer_32_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test fits integer 32 2", one.fits_integer_32)
|
||||
end
|
||||
|
||||
test_fits_integer_32_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits integer 32 3", not one.fits_integer_32)
|
||||
end
|
||||
|
||||
test_fits_integer_32_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test fits integer 32 4", not one.fits_integer_32)
|
||||
end
|
||||
|
||||
test_fits_integer_32_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits integer 32 5", one.fits_integer_32)
|
||||
end
|
||||
|
||||
test_fits_integer_64_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits integer 64 1", one.fits_integer_64)
|
||||
end
|
||||
|
||||
test_fits_integer_64_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test fits integer 64 2", one.fits_integer_64)
|
||||
end
|
||||
|
||||
test_fits_integer_64_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test fits integer 64 3", not one.fits_integer_64)
|
||||
end
|
||||
|
||||
test_fits_integer_64_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test fits integer 64 4", not one.fits_integer_64)
|
||||
end
|
||||
|
||||
test_fits_integer_64_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test fits integer 64 5", one.fits_integer_64)
|
||||
end
|
||||
|
||||
test_fits_integer_64_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test fits integer 64 6", one.fits_integer_64)
|
||||
end
|
||||
|
||||
test_fits_integer_64_7
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (0)
|
||||
assert ("test fits integer 64 7", one.fits_integer_64)
|
||||
end
|
||||
|
||||
test_swap
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (1)
|
||||
create two.make_from_integer (2)
|
||||
swap (one, two)
|
||||
assert ("{INTEGER_X}.swap 1", two.to_integer_32 = 1)
|
||||
assert ("{INTEGER_X}.swap 2", one.to_integer_32 = 2)
|
||||
end
|
||||
|
||||
test_init_set
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("0982430984230470238742037402394230948")
|
||||
create two.make_set (one)
|
||||
assert ("{INTEGER_X}.init_set", one ~ two)
|
||||
end
|
||||
|
||||
test_sub
|
||||
-- Test integer subtraction cases, ++ +- -+ --, 0 sum
|
||||
local
|
||||
posone: INTEGER_X
|
||||
postwo: INTEGER_X
|
||||
negone: INTEGER_X
|
||||
negtwo: INTEGER_X
|
||||
ans: INTEGER_X
|
||||
do
|
||||
create posone.make_from_integer (1000)
|
||||
create postwo.make_from_integer (2000)
|
||||
create negone.make_from_integer (-1000)
|
||||
create negtwo.make_from_integer (-2000)
|
||||
ans := posone - postwo
|
||||
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = 1000 - 2000)
|
||||
ans := postwo - negone
|
||||
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = 2000 - -1000)
|
||||
ans := negone - postwo
|
||||
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = -1000 - 2000)
|
||||
ans := negone - negtwo
|
||||
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = -1000 - -2000)
|
||||
ans := posone - posone
|
||||
assert ("{INTEGER_X}.sub test", ans.to_integer_32 = 1000 - 1000)
|
||||
end
|
||||
|
||||
test_negative
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (1)
|
||||
create two.make_from_integer (-1)
|
||||
assert ("test negative", one ~ two or one ~ -two)
|
||||
end
|
||||
|
||||
test_mul
|
||||
-- Test multiplication cases, +- -+
|
||||
local
|
||||
posone: INTEGER_X
|
||||
negone: INTEGER_X
|
||||
ans: INTEGER_X
|
||||
do
|
||||
create posone.make_from_integer (1000)
|
||||
create negone.make_from_integer (-1000)
|
||||
ans := posone * posone
|
||||
assert ("{INTEGER_X}.mul test", ans.to_integer_32 = 1000 * 1000)
|
||||
ans := posone * negone
|
||||
assert ("{INTEGER_X}.mul test", ans.to_integer_32 = 1000 * -1000)
|
||||
end
|
||||
|
||||
test_div
|
||||
-- Test integer division cases, pp, ppr, np, npr, nn, nnr
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
four: INTEGER_X
|
||||
quot: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (42)
|
||||
create two.make_from_integer (2)
|
||||
create three.make_from_integer (-42)
|
||||
create four.make_from_integer (-2)
|
||||
quot := one / two
|
||||
assert ("{INTEGER_X}.div test", quot.to_integer_32 = 42 // 2)
|
||||
quot := two / one
|
||||
assert ("{INTEGER_X}.div test", quot.to_integer_32 = 2 // 42)
|
||||
quot := three / two
|
||||
assert ("{INTEGER_X}.div test", quot.to_integer_32 = -42 // 2)
|
||||
quot := two / three
|
||||
assert ("{INTEGER_X}.div test", quot.to_integer_32 = 2 // -42)
|
||||
quot := three / four
|
||||
assert ("{INTEGER_X}.div test", quot.to_integer_32 = -42 // -2)
|
||||
quot := four / three
|
||||
assert ("{INTEGER_X}.div test", quot.to_integer_32 = -2 // -42)
|
||||
end
|
||||
|
||||
test_abs
|
||||
-- Test absolute value cases
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
ans: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (1)
|
||||
create two.make_from_integer (-1)
|
||||
create three.make_from_integer (0)
|
||||
ans := one.abs_value
|
||||
assert ("INTEGER_X.abs positive", ans.to_integer_32 = 1)
|
||||
ans := two.abs_value
|
||||
assert ("INTEGER_X.abs negative", ans.to_integer_32 = 1)
|
||||
ans := three.abs_value
|
||||
assert ("INTEGER_X.abs zero", ans.to_integer_32 = 0)
|
||||
end
|
||||
|
||||
test_comp
|
||||
-- Test comparison function cases
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three:INTEGER_X
|
||||
do
|
||||
create one.make_from_integer (1000)
|
||||
create two.make_from_integer (2000)
|
||||
create three.make_from_integer (1000)
|
||||
|
||||
assert ("INTEGER_X.comp eq", one.is_equal (three) = TRUE)
|
||||
assert ("INTEGER_X.comp lt", one.is_less (two) = TRUE)
|
||||
assert ("INTEGER_X.comp lt", two.is_less (one) = FALSE)
|
||||
assert ("INTEGER_X.comp le", one.is_less_equal (two) = TRUE)
|
||||
assert ("INTEGER_X.comp le", one.is_less_equal (three) = TRUE)
|
||||
assert ("INTEGER_X.comp le", two.is_less_equal (one) = FALSE)
|
||||
assert ("INTEGER_X.comp gt", one.is_greater (two) = FALSE)
|
||||
assert ("INTEGER_X.comp gt", two.is_greater (one) = TRUE)
|
||||
assert ("INTEGER_X.comp ge", one.is_greater_equal (two) = FALSE)
|
||||
assert ("INTEGER_X.comp ge", one.is_greater_equal (three) = TRUE)
|
||||
assert ("INTEGER_X.comp ge", two.is_greater_equal (one) = TRUE)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
395
contrib/ise_library/math/eapml/tests/test_integer_x_access.e
Normal file
395
contrib/ise_library/math/eapml/tests/test_integer_x_access.e
Normal file
@@ -0,0 +1,395 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_X_ACCESS}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_ACCESS
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_ACCESS
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_get_integer_64_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test get integer 64 1 1", one.fits_integer_64)
|
||||
assert ("test get integer 64 1 2", one.as_integer_64 = int.max_value)
|
||||
end
|
||||
|
||||
test_get_integer_64_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test get integer 64 2 1", one.fits_integer_64)
|
||||
assert ("test get integer 64 2 2", one.as_integer_64 = int.min_value)
|
||||
end
|
||||
|
||||
test_get_integer_64_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("0")
|
||||
assert ("test get integer 64 3 1", one.fits_integer_64)
|
||||
assert ("test get integer 64 3 2", one.as_integer_64 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_64_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("-1")
|
||||
assert ("test get integer 64 4 1", one.fits_integer_64)
|
||||
assert ("test get integer 64 4 2", one.as_integer_64 = -1)
|
||||
end
|
||||
|
||||
test_get_integer_64_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test get integer 64 5 1", not one.fits_integer_64)
|
||||
assert ("test get integer 64 5 2", one.as_integer_64 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_64_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test get integer 64 6 1", not one.fits_integer_64)
|
||||
assert ("test get integer 64 6 2", one.as_integer_64 = -1)
|
||||
end
|
||||
|
||||
test_get_integer_32_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test get integer 32 1 1", one.fits_integer_32)
|
||||
assert ("test get integer 32 1 2", one.as_integer_32 = int.max_value)
|
||||
end
|
||||
|
||||
test_get_integer_32_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test get integer 32 2 1", one.fits_integer_32)
|
||||
assert ("test get integer 32 2 2", one.as_integer_32 = int.min_value)
|
||||
end
|
||||
|
||||
test_get_integer_32_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("0")
|
||||
assert ("test get integer 32 3 1", one.fits_integer_32)
|
||||
assert ("test get integer 32 3 2", one.as_integer_32 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_32_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("-1")
|
||||
assert ("test get integer 32 4 1", one.fits_integer_32)
|
||||
assert ("test get integer 32 4 2", one.as_integer_32 = -1)
|
||||
end
|
||||
|
||||
test_get_integer_32_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test get integer 32 5 1", not one.fits_integer_32)
|
||||
assert ("test get integer 32 5 2", one.as_integer_32 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_32_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test get integer 32 6 1", not one.fits_integer_32)
|
||||
assert ("test get integer 32 6 2", one.as_integer_32 = -1)
|
||||
end
|
||||
|
||||
test_get_integer_16_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test get integer 16 1 1", one.fits_integer_16)
|
||||
assert ("test get integer 16 1 2", one.as_integer_16 = int.max_value)
|
||||
end
|
||||
|
||||
test_get_integer_16_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test get integer 16 2 1", one.fits_integer_16)
|
||||
assert ("test get integer 16 2 2", one.as_integer_16 = int.min_value)
|
||||
end
|
||||
|
||||
test_get_integer_16_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("0")
|
||||
assert ("test get integer 16 3 1", one.fits_integer_16)
|
||||
assert ("test get integer 16 3 2", one.as_integer_16 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_16_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("-1")
|
||||
assert ("test get integer 16 4 1", one.fits_integer_16)
|
||||
assert ("test get integer 16 4 2", one.as_integer_16 = -1)
|
||||
end
|
||||
|
||||
test_get_integer_16_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test get integer 16 5 1", not one.fits_integer_16)
|
||||
assert ("test get integer 16 5 2", one.as_integer_16 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_16_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test get integer 16 6 1", not one.fits_integer_16)
|
||||
assert ("test get integer 16 6 2", one.as_integer_16 = -1)
|
||||
end
|
||||
|
||||
test_get_integer_8_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
assert ("test get integer 8 1 1", one.fits_integer_8)
|
||||
assert ("test get integer 8 1 2", one.as_integer_8 = int.max_value)
|
||||
end
|
||||
|
||||
test_get_integer_8_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
assert ("test get integer 8 2 1", one.fits_integer_8)
|
||||
assert ("test get integer 8 2 2", one.as_integer_8 = int.min_value)
|
||||
end
|
||||
|
||||
test_get_integer_8_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("0")
|
||||
assert ("test get integer 8 3 1", one.fits_integer_8)
|
||||
assert ("test get integer 8 3 2", one.as_integer_8 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_8_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string ("-1")
|
||||
assert ("test get integer 8 4 1", one.fits_integer_8)
|
||||
assert ("test get integer 8 4 2", one.as_integer_8 = -1)
|
||||
end
|
||||
|
||||
test_get_integer_8_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.max_value.out)
|
||||
one.plus (one.one)
|
||||
assert ("test get integer 8 5 1", not one.fits_integer_8)
|
||||
assert ("test get integer 8 5 2", one.as_integer_8 = 0)
|
||||
end
|
||||
|
||||
test_get_integer_8_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_string (int.min_value.out)
|
||||
one.minus (one.one)
|
||||
assert ("test get integer 8 6 1", not one.fits_integer_8)
|
||||
assert ("test get integer 8 6 2", one.as_integer_8 = -1)
|
||||
end
|
||||
|
||||
test_get_str_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
output: STRING
|
||||
do
|
||||
create one.make_limbs (4)
|
||||
one.item [0] := 0x87654321
|
||||
one.item [1] := 0xcccccccc
|
||||
one.item [2] := 0x33333333
|
||||
one.item [3] := 0xffffffff
|
||||
one.count := 4
|
||||
output := one.out_base (16)
|
||||
assert ("test get str 1", "ffffffff33333333cccccccc87654321" ~ output)
|
||||
end
|
||||
|
||||
test_get_str_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
output: STRING
|
||||
do
|
||||
create one.make_limbs (4)
|
||||
one.item [0] := 0x87654321
|
||||
one.item [1] := 0xcccccccc
|
||||
one.item [2] := 0x33333333
|
||||
one.item [3] := 0xffffffff
|
||||
one.count := 4
|
||||
output := one.out_base (10)
|
||||
assert ("test get str 2", "340282366857555933463031183799994368801" ~ output)
|
||||
end
|
||||
|
||||
test_get_str_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
output: STRING
|
||||
i: INTEGER
|
||||
base: INTEGER
|
||||
do
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
i > 1000
|
||||
loop
|
||||
base := i \\ 61 + 2
|
||||
create one.make_random (256)
|
||||
output := one.out_base (base)
|
||||
create two.make_from_string_base (output, base)
|
||||
assert ("test get str 3", one ~ two)
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
test_get_str_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
output: STRING
|
||||
do
|
||||
create one.make_limbs (8)
|
||||
one.item [0] := 0x99811941
|
||||
one.item [1] := 0x841FD605
|
||||
one.item [2] := 0xD960A1BF
|
||||
one.item [3] := 0x5E433EFC
|
||||
one.item [4] := 0x48C9BC93
|
||||
one.item [5] := 0x1C8B6FB1
|
||||
one.item [6] := 0x8CA06DE0
|
||||
one.item [7] := 0xC6182337
|
||||
one.count := 8
|
||||
output := one.out_base (10)
|
||||
assert ("test get str 4", output ~ "89600591407770348063754312463218194105764385355557091513583682190076098451777")
|
||||
end
|
||||
|
||||
test_get_str_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
output: STRING
|
||||
do
|
||||
create one.make_limbs (8)
|
||||
one.item [0] := 0x99811941
|
||||
one.item [1] := 0x841FD605
|
||||
one.item [2] := 0xD960A1BF
|
||||
one.item [3] := 0x5E433EFC
|
||||
one.item [4] := 0x48C9BC93
|
||||
one.item [5] := 0x1C8B6FB1
|
||||
one.item [6] := 0x8CA06DE0
|
||||
one.item [7] := 0xC6182337
|
||||
one.count := 8
|
||||
output := one.out_base (3)
|
||||
assert ("test get str 5", output ~ "110022012022022000201210111012211020111202020222100010210022020220110011011010201011020001011210101000122212110112010121211022120122101102102020102011202010010112")
|
||||
end
|
||||
|
||||
test_get_str_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
output: STRING
|
||||
do
|
||||
create one.make_limbs (8)
|
||||
one.item [7] := 0x8134b7f7
|
||||
one.item [6] := 0x8d570cbf
|
||||
one.item [5] := 0xeb5f7c66
|
||||
one.item [4] := 0x7aa64334
|
||||
one.item [3] := 0xbb6cd783
|
||||
one.item [2] := 0x22792988
|
||||
one.item [1] := 0x6ec0f7ac
|
||||
one.item [0] := 0x4438ad87
|
||||
one.count := 8
|
||||
output := one.out_base (7)
|
||||
assert ("test get str 6", output ~ "5050422450443414252030234161450453214063666050554216601312032162510626626621233550541413260")
|
||||
end
|
||||
|
||||
test_get_str_7
|
||||
local
|
||||
one: INTEGER_X
|
||||
output: STRING
|
||||
do
|
||||
create one.make_limbs (8)
|
||||
one.item [0] := 0x8134b7f7
|
||||
one.item [1] := 0x8d570cbf
|
||||
one.item [2] := 0xeb5f7c66
|
||||
one.item [3] := 0x7aa64334
|
||||
one.item [4] := 0xbb6cd783
|
||||
one.item [5] := 0x22792988
|
||||
one.item [6] := 0x6ec0f7ac
|
||||
one.item [7] := 0x4438ad87
|
||||
one.count := 8
|
||||
output := one.out_base (7)
|
||||
assert ("test get str 7", output ~ "2460223246331335544520513341363224654146046636101125253015521231163466226621435340120452343")
|
||||
end
|
||||
|
||||
test_get_str_8
|
||||
local
|
||||
one: INTEGER_X
|
||||
output: STRING
|
||||
do
|
||||
create one.make_from_integer (-1)
|
||||
output := one.out_hex
|
||||
assert ("test get str 7", output ~ "-1")
|
||||
end
|
||||
end
|
||||
208
contrib/ise_library/math/eapml/tests/test_integer_x_arithmetic.e
Normal file
208
contrib/ise_library/math/eapml/tests/test_integer_x_arithmetic.e
Normal file
@@ -0,0 +1,208 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_ARITHMETIC}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_ARITHMETIC
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_ARITHMETIC
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_add_1
|
||||
-- Test integer addition cases, ++ +- -+ --, 0 sum
|
||||
local
|
||||
posone: INTEGER_X
|
||||
postwo: INTEGER_X
|
||||
negone: INTEGER_X
|
||||
negtwo: INTEGER_X
|
||||
ans: INTEGER_X
|
||||
do
|
||||
create posone.make_from_integer (1000)
|
||||
create postwo.make_from_integer (2000)
|
||||
create negone.make_from_integer (-1000)
|
||||
create negtwo.make_from_integer (-2000)
|
||||
ans := posone + postwo
|
||||
assert ("{INTEGER_X}.add test", ans.to_integer_32 = 1000 + 2000)
|
||||
ans := postwo + negone
|
||||
assert ("{INTEGER_X}.add test", ans.to_integer_32 = 2000 + -1000)
|
||||
ans := negone + postwo
|
||||
assert ("{INTEGER_X}.add test", ans.to_integer_32 = -1000 + 2000)
|
||||
ans := negone + negtwo
|
||||
assert ("{INTEGER_X}.add test", ans.to_integer_32 = -1000 + -2000)
|
||||
ans := posone + negone
|
||||
assert ("{INTEGER_X}.add test", ans.to_integer_32 = 1000 + -1000)
|
||||
end
|
||||
|
||||
test_add_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one.make_limbs (6)
|
||||
create two.make_from_hex_string ("343bd97a 7e17702a 800c8f10 54ad58f6 1f07c505")
|
||||
create three.make_from_hex_string ("ffffffff ffffffff ffffffff ffffffff 7ffffffc")
|
||||
create expected.make_from_hex_string ("1343bd97a7e17702a800c8f1054ad58f59f07c501")
|
||||
add (one, two, three)
|
||||
assert ("test add 2", one ~ expected)
|
||||
end
|
||||
|
||||
test_add_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("a9993e364706816aba3e25717850c26c9cd0d89d")
|
||||
create three.make_from_hex_string ("8913681113524c02ac9b2b8777f53c1feb356bfbc122bf1970d1ccc8fc43f9bb8aec1812ee98e4a2")
|
||||
create expected.make_from_hex_string ("8913681113524c02ac9b2b8777f53c1feb356bfc6abbfd4fb7d84e33b6821f2d033cda7f8b69bd3f")
|
||||
add (one, two, three)
|
||||
assert ("test add 3", one ~ expected)
|
||||
end
|
||||
|
||||
test_add_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("-7231ea35689f4fd7ce163d502a7e14c99947e909fb2a9d7cad460fb337fae053af6e5a5419a6800c19f28b09a3a1f005621dd631b6d93fcc32e4e6069e76fb15")
|
||||
create three.make_from_hex_string ("1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
|
||||
create expected.make_from_hex_string ("1ff8dce15ca9760b02831e9c2afd581eb3666b816f604d5628352b9f04cc8051fac5091a5abe6597ff3e60d74f65c5e0ffa9de229ce4926c033cd1b19f9618904ea")
|
||||
add (one, two, three)
|
||||
assert ("test add 4", one ~ expected)
|
||||
end
|
||||
|
||||
test_sub_1
|
||||
local
|
||||
one_three: INTEGER_X
|
||||
two: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one_three.make_from_hex_string ("014fae42 56ad0915 2a7b2b66 fe887b52 e06ffa35 d359cd33 14156137 564096ef 90eb9c01 9ee82ea9")
|
||||
create two.make_from_hex_string ("1")
|
||||
create expected.make_from_hex_string ("-014fae42 56ad0915 2a7b2b66 fe887b52 e06ffa35 d359cd33 14156137 564096ef 90eb9c01 9ee82ea8")
|
||||
sub (one_three, two, one_three)
|
||||
assert ("test sub 1", one_three ~ expected)
|
||||
end
|
||||
|
||||
test_sub_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("1429cb78799228669deb4a9025f308ab78be74ae")
|
||||
create three.make_from_hex_string ("-f7c5cdcb7d66c16bbf17e81de30488c02078684")
|
||||
create expected.make_from_hex_string ("23a628553168947d59dcc912042351377ac5fb32")
|
||||
sub (one, two, three)
|
||||
assert ("test sub 2", one ~ expected)
|
||||
end
|
||||
|
||||
test_mul_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one.make_limbs (10)
|
||||
create two.make_limbs (5)
|
||||
create three.make_limbs (6)
|
||||
create expected.make_from_hex_string ("30f2de49 bab11556 78be37e5 d4205117 663c6cc5 5fd1e2bd 41b4a8fd 35ce30b2 07939fb8 c29af9f6")
|
||||
two.item [0] := 0x9f07c4ff
|
||||
two.item [1] := 0xd4ad58f1
|
||||
two.item [2] := 0x800c8f0e
|
||||
two.item [3] := 0x7e17702a
|
||||
two.item [4] := 0x343bd97a
|
||||
two.count := 5
|
||||
three.item [0] := 0xfb4ab80a
|
||||
three.item [1] := 0x2077ac6a
|
||||
three.item [2] := 0x5bdd4431
|
||||
three.item [3] := 0x6672da8e
|
||||
three.item [4] := 0xefe650c5
|
||||
three.count := 5
|
||||
mul (one, two, three)
|
||||
assert ("test mul 1", expected ~ one)
|
||||
end
|
||||
|
||||
test_mul_2
|
||||
local
|
||||
one_three: INTEGER_X
|
||||
two: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one_three.make_limbs (6)
|
||||
create two.make_limbs (5)
|
||||
create expected.make_from_hex_string ("30f2de49 bab11556 78be37e5 d4205117 663c6cc5 5fd1e2bd 41b4a8fd 35ce30b2 07939fb8 c29af9f6")
|
||||
two.item [0] := 0x9f07c4ff
|
||||
two.item [1] := 0xd4ad58f1
|
||||
two.item [2] := 0x800c8f0e
|
||||
two.item [3] := 0x7e17702a
|
||||
two.item [4] := 0x343bd97a
|
||||
two.count := 5
|
||||
one_three.item [0] := 0xfb4ab80a
|
||||
one_three.item [1] := 0x2077ac6a
|
||||
one_three.item [2] := 0x5bdd4431
|
||||
one_three.item [3] := 0x6672da8e
|
||||
one_three.item [4] := 0xefe650c5
|
||||
one_three.count := 5
|
||||
mul (one_three, two, one_three)
|
||||
assert ("test mul 1", expected ~ one_three)
|
||||
end
|
||||
|
||||
test_mul_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("-e69e4c55 8d0e2ed0 10128582 48b54fe8 8e87802e c871b791 5347fc54 8fb749de 9bc6e6b7 1868a715 859bcde6 96d6f196 37ad0367 26bc4cea 65f0d20e 67321392")
|
||||
create three.make_from_hex_string ("000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff")
|
||||
create expected.make_from_hex_string ("-1cd3c98ab1a1c5da020250b04916a9fd11d0f005d90e36f22a68ff8a91f6e93bd378dcd6e30d14e2b0b379bcd2dade32c6f5a06ce4d7899d4cbe1a41cce642723ff1961b3aa72f1d12fefed7a7db74ab01771787fd1378e486eacb803ab7048b62164391948e79758ea7a64321969290e69c852fc98d943b3159a0f2df198cdec6e")
|
||||
mul (one, two, three)
|
||||
assert ("test mul 3", one ~ expected)
|
||||
end
|
||||
|
||||
test_mul_2exp_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one.make_limbs (7)
|
||||
create two.make_from_hex_string ("2 fe13c053 7bbc11ac aa07d793 de4e6d5e 5c94eee8")
|
||||
create expected.make_from_hex_string ("0000000b f84f014d eef046b2 a81f5e4f 7939b579 7253bba0")
|
||||
mul_2exp (one, two, 2)
|
||||
assert ("test mul 2exp 1", one ~ expected)
|
||||
end
|
||||
|
||||
test_mul_2exp_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("8 00000000 00000000 00000000 00000000 00000000")
|
||||
create expected.make_from_hex_string ("8 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000")
|
||||
mul_2exp (one, two, 0x80)
|
||||
assert ("test mul 2exp 2", one ~ expected)
|
||||
end
|
||||
end
|
||||
217
contrib/ise_library/math/eapml/tests/test_integer_x_assignment.e
Normal file
217
contrib/ise_library/math/eapml/tests/test_integer_x_assignment.e
Normal file
@@ -0,0 +1,217 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_X_ASSIGNMENT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_ASSIGNMENT
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_ASSIGNMENT
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_set_str_1
|
||||
local
|
||||
target: INTEGER_X
|
||||
do
|
||||
create target
|
||||
set_str (target, "100", 10)
|
||||
assert ("test set str 1 1", target.item [0] = 100 and target.count = 1)
|
||||
|
||||
set_str (target, "10000000000", 10)
|
||||
assert ("test set str 1 2", target.item [0] = 0x540be400 and target.item [1] = 0x00000002 and target.count = 2)
|
||||
end
|
||||
|
||||
test_set_str_2
|
||||
local
|
||||
target: INTEGER_X
|
||||
do
|
||||
create target
|
||||
set_str (target, "1000", 16)
|
||||
assert ("test set str 1 1", target.item [0] = 0x1000 and target.count = 1)
|
||||
|
||||
set_str (target, "100000000000", 16)
|
||||
assert ("test set str 1 2", target.item [0] = 0x00000000 and target.item [1] = 0x00001000 and target.count = 2)
|
||||
end
|
||||
|
||||
test_set_str_3
|
||||
local
|
||||
target: INTEGER_X
|
||||
do
|
||||
create target
|
||||
set_str (target, " 1 0 0 0 ", 16)
|
||||
assert ("test set str 3 1", target.item [0] = 0x1000 and target.count = 1)
|
||||
set_str (target, " 1 0 0 0 0 0 0 0 0 0 0 0 ", 16)
|
||||
assert ("test set str 3 2", target.item [0] = 0x00000000 and target.item [1] = 0x00001000 and target.count = 2)
|
||||
end
|
||||
|
||||
test_set_str_4
|
||||
local
|
||||
target: INTEGER_X
|
||||
do
|
||||
create target
|
||||
set_str (target, " 0x 1 0 0 0 ", 0)
|
||||
assert ("test set str 3 1", target.item [0] = 0x1000 and target.count = 1)
|
||||
set_str (target, " 0", 0)
|
||||
assert ("test set str 3 2", target.count = 0)
|
||||
end
|
||||
|
||||
test_set_str_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string_base ("5050422450443414252030234161450453214063666050554216601312032162510626626621233550541413260", 7)
|
||||
assert ("test set str 5", one.item [7] = 0x8134b7f7 and one.item [6] = 0x8d570cbf and one.item [5] = 0xeb5f7c66 and one.item [4] = 0x7aa64334 and one.item [3] = 0xbb6cd783 and one.item [2] = 0x22792988 and one.item [1] = 0x6ec0f7ac and one.item [0] = 0x4438ad87 and one.count = 8)
|
||||
end
|
||||
|
||||
test_set_str_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_string_base ("2460223246331335544520513341363224654146046636101125253015521231163466226621435340120452343", 7)
|
||||
assert ("test set str 6", one.item [0] = 0x8134b7f7 and one.item [1] = 0x8d570cbf and one.item [2] = 0xeb5f7c66 and one.item [3] = 0x7aa64334 and one.item [4] = 0xbb6cd783 and one.item [5] = 0x22792988 and one.item [6] = 0x6ec0f7ac and one.item [7] = 0x4438ad87 and one.count = 8)
|
||||
end
|
||||
|
||||
test_set_str_7
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_hex_string ("1")
|
||||
assert ("test set str 7", one.item [0] = 0x1 and one.count = 1)
|
||||
end
|
||||
|
||||
test_set_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
do
|
||||
create one.make_from_hex_string ("f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff")
|
||||
assert ("test set 1 1", one.item [0] = 0xfcfdfeff and one.item [1] = 0xf8f9fafb and one.item [2] = 0xf4f5f6f7 and one.item [3] = 0xf0f1f2f3 and one.count = 4)
|
||||
create two
|
||||
two.copy (one)
|
||||
assert ("test set 1 2", one ~ two)
|
||||
assert ("test set 1 3", one.item [0] = 0xfcfdfeff and one.item [1] = 0xf8f9fafb and one.item [2] = 0xf4f5f6f7 and one.item [3] = 0xf0f1f2f3 and one.count = 4)
|
||||
assert ("test set 1 4", two.item [0] = 0xfcfdfeff and two.item [1] = 0xf8f9fafb and two.item [2] = 0xf4f5f6f7 and two.item [3] = 0xf0f1f2f3 and two.count = 4)
|
||||
end
|
||||
|
||||
test_set_from_integer_64_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_integer_64 (int.min_value)
|
||||
assert ("test set from integer 64 1 1", one.fits_integer_64)
|
||||
assert ("test set from integer 64 1 2", one.to_integer_64 = int.min_value)
|
||||
end
|
||||
|
||||
test_set_from_integer_64_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer_64 (-1)
|
||||
assert ("test set from integer 64 2 1", one.fits_integer_64)
|
||||
assert ("test set from integer 64 2 2", one.to_integer_64 = -1)
|
||||
end
|
||||
|
||||
test_set_from_integer_64_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_64
|
||||
do
|
||||
create one.make_from_integer_64 (int.max_value)
|
||||
assert ("test set from integer 64 3 1", one.fits_integer_64)
|
||||
assert ("test set from integer 64 3 2", one.to_integer_64 = int.max_value)
|
||||
end
|
||||
|
||||
test_set_from_integer_32_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_integer_32 (int.min_value)
|
||||
assert ("test set from integer 32 1 1", one.fits_integer_32)
|
||||
assert ("test set from integer 32 1 2", one.to_integer_32 = int.min_value)
|
||||
end
|
||||
|
||||
test_set_from_integer_32_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer_32 (-1)
|
||||
assert ("test set from integer 32 2 1", one.fits_integer_32)
|
||||
assert ("test set from integer 32 2 2", one.to_integer_32 = -1)
|
||||
end
|
||||
|
||||
test_set_from_integer_32_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_32
|
||||
do
|
||||
create one.make_from_integer_32 (int.max_value)
|
||||
assert ("test set from integer 32 3 1", one.fits_integer_32)
|
||||
assert ("test set from integer 32 3 2", one.to_integer_32 = int.max_value)
|
||||
end
|
||||
|
||||
test_set_from_integer_16_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_integer_16 (int.min_value)
|
||||
assert ("test set from integer 16 1 1", one.fits_integer_16)
|
||||
assert ("test set from integer 16 1 2", one.to_integer_16 = int.min_value)
|
||||
end
|
||||
|
||||
test_set_from_integer_16_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer_16 (-1)
|
||||
assert ("test set from integer 16 2 1", one.fits_integer_16)
|
||||
assert ("test set from integer 16 2 2", one.to_integer_16 = -1)
|
||||
end
|
||||
|
||||
test_set_from_integer_16_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_16
|
||||
do
|
||||
create one.make_from_integer_16 (int.max_value)
|
||||
assert ("test set from integer 16 3 1", one.fits_integer_16)
|
||||
assert ("test set from integer 16 3 2", one.to_integer_16 = int.max_value)
|
||||
end
|
||||
|
||||
test_set_from_integer_8_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_integer_8 (int.min_value)
|
||||
assert ("test set from integer 8 1 1", one.fits_integer_8)
|
||||
assert ("test set from integer 8 1 2", one.to_integer_8 = int.min_value)
|
||||
end
|
||||
|
||||
test_set_from_integer_8_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
do
|
||||
create one.make_from_integer_8 (-1)
|
||||
assert ("test set from integer 8 2 1", one.fits_integer_8)
|
||||
assert ("test set from integer 8 2 2", one.to_integer_8 = -1)
|
||||
end
|
||||
|
||||
test_set_from_integer_8_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
int: INTEGER_8
|
||||
do
|
||||
create one.make_from_integer_8 (int.max_value)
|
||||
assert ("test set from integer 8 3 1", one.fits_integer_8)
|
||||
assert ("test set from integer 8 3 2", one.to_integer_8 = int.max_value)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
note
|
||||
description: "Summary description for {INTEGER_X_DIVISION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_DIVISION
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_DIVISION
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_tdiv_q_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("-014fae42 56ad0915 2a7b2b66 fe887b52 e06ffa35 d359cd33 14156137 564096ef 90eb9c01 9ee82ea9")
|
||||
create three.make_from_hex_string ("474c50aa 62d128fa b3b99224 0846a26e f58bf664")
|
||||
create expected.make_from_hex_string ("-04b547f5 df885395 a422bbce 998d2570 9019af3a")
|
||||
tdiv_q (one, two, three)
|
||||
assert ("test tdiv q 1", one ~ expected)
|
||||
end
|
||||
end
|
||||
92
contrib/ise_library/math/eapml/tests/test_integer_x_gcd.e
Normal file
92
contrib/ise_library/math/eapml/tests/test_integer_x_gcd.e
Normal file
@@ -0,0 +1,92 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_X_GCD}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_GCD
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_GCD
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_gcd_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("75bd a09fab66 22ddfba5 6141c975")
|
||||
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
|
||||
create expected.make_from_integer (1)
|
||||
gcd (one, two, three)
|
||||
assert ("test gcd 1", one ~ expected)
|
||||
end
|
||||
|
||||
test_gcd_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("1f3e 0565ad11 0943df37 0be1f345")
|
||||
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
|
||||
create expected.make_from_integer (1)
|
||||
gcd (one, two, three)
|
||||
assert ("test gcd 2", one ~ expected)
|
||||
end
|
||||
|
||||
test_gcd_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("b900 97df5038 7e2f36a6 2ed3a8f4")
|
||||
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
|
||||
create expected.make_from_integer (1)
|
||||
gcd (one, two, three)
|
||||
assert ("test gcd 3", one ~ expected)
|
||||
end
|
||||
|
||||
test_gcd_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("905a 1c3f4cec 73b96934 ac732c70")
|
||||
create three.make_from_hex_string ("db7c 2abf62e3 5e668076 bead208b")
|
||||
create expected.make_from_integer (1)
|
||||
gcd (one, two, three)
|
||||
assert ("test gcd 4", one ~ expected)
|
||||
end
|
||||
|
||||
test_gcd_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("1ffb369d437c5d32145fd9a1223ab960e362ffd5545b675f7ead44be35a12c61699c05dd8ecafb643b9feb6912fb6df6c57eca1c0e4ff132ed5d77d6bb5d96a4395")
|
||||
create three.make_from_hex_string ("1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
|
||||
create expected.make_from_hex_string ("1")
|
||||
gcd (one, two, three)
|
||||
assert ("test gcd 5", one ~ expected)
|
||||
end
|
||||
end
|
||||
89
contrib/ise_library/math/eapml/tests/test_integer_x_io.e
Normal file
89
contrib/ise_library/math/eapml/tests/test_integer_x_io.e
Normal file
@@ -0,0 +1,89 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_X_IO}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_IO
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_IO
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_export_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: SPECIAL [NATURAL_8]
|
||||
junk: TUPLE [junk: INTEGER]
|
||||
do
|
||||
create junk
|
||||
create one.make_limbs (6)
|
||||
one.item [0] := 0x7393172a
|
||||
one.item [1] := 0xe93d7e11
|
||||
one.item [2] := 0x2e409f96
|
||||
one.item [3] := 0x6bc1bee2
|
||||
one.count := 4
|
||||
create two.make_filled (0, 16)
|
||||
output (two, 0, junk, 1, 1, -1, one)
|
||||
assert ("test output 1 1", two [0] = 0x6b and two [1] = 0xc1 and two [2] = 0xbe and two [3] = 0xe2)
|
||||
assert ("test output 1 2", two [4] = 0x2e and two [5] = 0x40 and two [6] = 0x9f and two [7] = 0x96)
|
||||
assert ("test output 1 3", two [8] = 0xe9 and two [9] = 0x3d and two [10] = 0x7e and two [11] = 0x11)
|
||||
assert ("test output 1 4", two [12] = 0x73 and two [13] = 0x93 and two [14] = 0x17 and two [15] = 0x2a)
|
||||
end
|
||||
|
||||
test_import_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: SPECIAL [NATURAL_8]
|
||||
do
|
||||
create two.make_filled (0, 16)
|
||||
two [0] := 0x6b two [1] := 0xc1 two [2] := 0xbe two [3] := 0xe2
|
||||
two [4] := 0x2e two [5] := 0x40 two [6] := 0x9f two [7] := 0x96
|
||||
two [8] := 0xe9 two [9] := 0x3d two [10] := 0x7e two [11] := 0x11
|
||||
two [12] := 0x73 two [13] := 0x93 two [14] := 0x17 two [15] := 0x2a
|
||||
create one
|
||||
input (one, 16, 1, 1, -1, two, 0)
|
||||
assert ("test input 1", one.item [0] = 0x7393172a and one.item [1] = 0xe93d7e11 and one.item [2] = 0x2e409f96 and one.item [3] = 0x6bc1bee2)
|
||||
end
|
||||
|
||||
test_export_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: SPECIAL [NATURAL_8]
|
||||
junk: TUPLE [junk: INTEGER]
|
||||
do
|
||||
create junk
|
||||
create one.make_limbs (6)
|
||||
one.item [0] := 0x0c0d0e0f
|
||||
one.item [1] := 0x08090a0b
|
||||
one.item [2] := 0x04050607
|
||||
one.item [3] := 0x00010203
|
||||
one.count := 4
|
||||
create two.make_filled (0, 16)
|
||||
output (two, 0, junk, 1, 1, -1, one)
|
||||
assert ("test export 1 1", two [0] = 0x01 and two [1] = 0x02 and two [2] = 0x03 and two [3] = 0x04)
|
||||
assert ("test export 1 2", two [4] = 0x05 and two [5] = 0x06 and two [6] = 0x07 and two [7] = 0x08)
|
||||
assert ("test export 1 3", two [8] = 0x09 and two [9] = 0x0a and two [10] = 0x0b and two [11] = 0x0c)
|
||||
assert ("test export 1 4", two [12] = 0x0d and two [13] = 0x0e and two [14] = 0x0f and two [15] = 0x00)
|
||||
end
|
||||
|
||||
test_import_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: SPECIAL [NATURAL_8]
|
||||
do
|
||||
create two.make_filled (0, 16)
|
||||
two [0] := 0x01 two [1] := 0x02 two [2] := 0x03 two [3] := 0x04
|
||||
two [4] := 0x05 two [5] := 0x06 two [6] := 0x07 two [7] := 0x08
|
||||
two [8] := 0x09 two [9] := 0x0a two [10] := 0x0b two [11] := 0x0c
|
||||
two [12] := 0x0d two [13] := 0x0e two [14] := 0x0f two [15] := 0x0
|
||||
create one
|
||||
input (one, 16, 1, 1, -1, two, 0)
|
||||
assert ("test import 2", one.item [0] = 0x0d0e0f00 and one.item [1] = 0x090a0b0c and one.item [2] = 0x05060708 and one.item [3] = 0x01020304)
|
||||
end
|
||||
end
|
||||
126
contrib/ise_library/math/eapml/tests/test_integer_x_logic.e
Normal file
126
contrib/ise_library/math/eapml/tests/test_integer_x_logic.e
Normal file
@@ -0,0 +1,126 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_X_LOGIC}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_LOGIC
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_LOGIC
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
|
||||
test_xor_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("7253bba0 7253bba0 7253bba0 7253bba0 7253bba0")
|
||||
create three.make_from_hex_string ("5fc2780a 6f778235 9540faf2 7bc9cdab cb929ddd")
|
||||
create expected.make_from_hex_string ("2d91c3aa 1d243995 e7134152 099a760b b9c1267d")
|
||||
bit_xor (one, two, three)
|
||||
assert ("test xor 1", one ~ expected)
|
||||
end
|
||||
|
||||
test_xor_lshift_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("7253bba0 7253bba0 7253bba0 7253bba0 7253bba0")
|
||||
create three.make_from_hex_string ("5fc2780a 6f778235 9540faf2 7bc9cdab cb929ddd")
|
||||
create expected.make_from_hex_string ("5fc2 780a6f77 f0662ee0 88a1c069 bff87032 ef8ebba0 7253bba0")
|
||||
bit_xor_lshift (one, two, three, 48)
|
||||
assert ("test xor lshift 1", one ~ expected)
|
||||
end
|
||||
|
||||
test_walking_xor_1
|
||||
local
|
||||
i: INTEGER
|
||||
ones: INTEGER_X
|
||||
zero: INTEGER_X
|
||||
cursor: INTEGER_X
|
||||
xored: INTEGER_X
|
||||
j: INTEGER
|
||||
do
|
||||
create zero
|
||||
create ones.make_from_hex_string ("ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff")
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
i >= 256
|
||||
loop
|
||||
cursor := zero.bit_complement_value (i)
|
||||
xored := cursor.bit_xor_value (ones)
|
||||
from
|
||||
j := 0
|
||||
until
|
||||
j >= 256
|
||||
loop
|
||||
assert ("test walking xor 1 iteration: " + i.out, (j /= i) = xored.bit_test (j))
|
||||
j := j + 1
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
test_walking_set_bit_1
|
||||
local
|
||||
i: INTEGER
|
||||
j: INTEGER
|
||||
zero: INTEGER_X
|
||||
cursor: INTEGER_X
|
||||
do
|
||||
create zero.default_create
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
i >= 256
|
||||
loop
|
||||
cursor := zero.set_bit_value (true, i)
|
||||
from
|
||||
j := 0
|
||||
until
|
||||
j >= 256
|
||||
loop
|
||||
assert ("test walking set bit 1 iteration: " + i.out, (j = i) = cursor.bit_test (j))
|
||||
j := j + 1
|
||||
end
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
test_bit_clear_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one.make_from_hex_string ("c 7ea29e73 e8b0ed09 f2d91bac ab1cd267 343dfdb2")
|
||||
create expected.make_from_hex_string ("4 7ea29e73 e8b0ed09 f2d91bac ab1cd267 343dfdb2")
|
||||
bit_clear (one, 0xa3)
|
||||
assert ("test bit clear 1", one ~ expected)
|
||||
end
|
||||
|
||||
test_bit_clear_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one.make_from_hex_string ("ece1f5243f82d99431001da4573c")
|
||||
one.set_bit (False, 226)
|
||||
create expected.make_from_hex_string ("ece1f5243f82d99431001da4573c")
|
||||
assert ("test bit clear 2", one ~ expected)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,266 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_X_NUMBER_THEORY}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_NUMBER_THEORY
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_NUMBER_THEORY
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_invert_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
has: BOOLEAN
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("474c50aa 62d128fa b3b99224 0846a26e f58bf664")
|
||||
create three.make_from_hex_string ("ffffffff ffffffff ffffffff ffffffff 7fffffff")
|
||||
create expected.make_from_hex_string ("fb4ab80a 2077ac6a 5bdd4431 6672da8e efe650c5")
|
||||
has := invert (one, two, three)
|
||||
assert ("test invert 1", has and one ~ expected)
|
||||
end
|
||||
|
||||
test_invert_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
has: BOOLEAN
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("51875f78 fcf4ae64 66099f92 3707f601")
|
||||
create three.make_from_hex_string ("fffffffd ffffffff ffffffff ffffffff")
|
||||
create expected.make_from_hex_string ("86043be0 479c80d7 d8181a73 7e4b676a")
|
||||
has := invert (one, two, three)
|
||||
assert ("test invert 2", has and one ~ expected)
|
||||
end
|
||||
|
||||
test_invert_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
has: BOOLEAN
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("4aa462dfb47b5da4294b5351ba91eaa46e808bc8052e951c4f2508a87b96ef400b15f688d8e16b449bf3247ffcddb250b39605a9c31de7167167504b440f14bc")
|
||||
create three.make_from_hex_string ("1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
|
||||
create expected.make_from_hex_string ("1ff8dce15ca9760b02831e9c2afd581eb3666b816f604d5628352b9f04cc8051fac5091a5abe6597ff3e60d74f65c5e0ffa9de229ce4926c033cd1b19f9618904ea")
|
||||
has := invert (one, two, three)
|
||||
assert ("test invert 3", has and one ~ expected)
|
||||
end
|
||||
|
||||
test_invert_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
four: INTEGER_X
|
||||
has: BOOLEAN
|
||||
i: INTEGER
|
||||
one_constant: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create three.make_from_string ("35742549198872617291353508656626642567")
|
||||
create one_constant.make_from_integer (1)
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
i > 1000
|
||||
loop
|
||||
create two.make_random_max (three)
|
||||
has := invert (one, two, three)
|
||||
four := one * two \\ three
|
||||
assert ("test invert 4 iteration: " + i.out, has and four ~ one_constant)
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
|
||||
test_invert_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
has: BOOLEAN
|
||||
do
|
||||
create one
|
||||
create two.make_from_hex_string ("3a4085c123535aa7ad14d55c0b3765c55c5b78b946517c14438ad876ec0f7ac22792988bb6cd7837aa64334eb5f7c668d570cbf8134b7f7e87eefa95179ca11bedcdf420eb6df91")
|
||||
create three.make_from_hex_string ("3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe661ce18ff55987308059b186823851ec7dd9ca1161de93d5174d66e8382e9bb2fe84e47")
|
||||
create expected.make_from_hex_string ("14f365462bac9e4b1fd955049cd7320d0d4ce2cec67d60ee2011ec10879cdb60f61ec86bda440358278bb5592cce8bfddee8c57c1565cf47eb89854ecd76f341bf19bf326671aa1")
|
||||
has := invert (one, two, three)
|
||||
assert ("test invert 5", has and one ~ expected)
|
||||
end
|
||||
|
||||
test_probably_prime_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_integer (11)
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 1", val = 2)
|
||||
end
|
||||
|
||||
test_probably_prime_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_integer (2_147_483_647)
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 2", val = 1)
|
||||
end
|
||||
|
||||
test_probably_prime_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_string ("2 305 843 009 213 693 951")
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 3", val = 1)
|
||||
end
|
||||
|
||||
test_probably_prime_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_string ("59 604 644 783 353 249")
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 4", val = 1)
|
||||
end
|
||||
|
||||
test_probably_prime_5
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_string ("43 143 988 327 398 957 279 342 419 750 374 600 193")
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 5", val = 1)
|
||||
end
|
||||
|
||||
test_probably_prime_6
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_string ("2074722246773485207821695222107608587480996474721117292752992589912196684750549658310084416732550077")
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 6", val = 1)
|
||||
end
|
||||
|
||||
test_probably_prime_7
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_string ("236749577021714299526482794866680 9 233066409497699870112003149352380375124855230068487109373226251983")
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 7", val = 1)
|
||||
end
|
||||
|
||||
test_probably_prime_8
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_string ("236749577021714299526482794866680 8 233066409497699870112003149352380375124855230068487109373226251983")
|
||||
val := probab_prime_p (one, 10)
|
||||
assert ("test probably prime 7", val = 0)
|
||||
end
|
||||
|
||||
test_gcdext_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
four: INTEGER_X
|
||||
five: INTEGER_X
|
||||
expected_1: INTEGER_X
|
||||
expected_2: INTEGER_X
|
||||
do
|
||||
create one.make_limbs (6)
|
||||
create two.make_limbs (6)
|
||||
create four.make_from_hex_string ("474c50aa 62d128fa b3b99224 0846a26e f58bf664")
|
||||
create five.make_from_hex_string ("ffffffff ffffffff ffffffff ffffffff 7fffffff")
|
||||
create expected_1.make_from_integer (1)
|
||||
create expected_2.make_from_hex_string ("-00000000 04b547f5 df885395 a422bbce 998d2570 9019af3a")
|
||||
gcdext (one, two, void, four, five)
|
||||
assert ("test gcdext 1", one ~ expected_1 and two ~ expected_2)
|
||||
end
|
||||
|
||||
test_millerrabin_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_from_string ("2 305 843 009 213 693 951")
|
||||
val := millerrabin (one, 10)
|
||||
assert ("test probably prime 3", val = 1)
|
||||
end
|
||||
|
||||
test_powm_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
four: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_integer (0xd2)
|
||||
create three.make_from_integer (0x7ffffffe)
|
||||
create four.make_from_integer (0x7fffffff)
|
||||
create expected.make_from_integer (1)
|
||||
powm (one, two, three, four)
|
||||
assert ("test powm 1", one ~ expected)
|
||||
end
|
||||
|
||||
test_powm_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: INTEGER_X
|
||||
three: INTEGER_X
|
||||
four: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make_from_integer (0xd2)
|
||||
create three.make_from_hex_string ("1ffffff ffffffffe")
|
||||
create four.make_from_hex_string ("1fffffff ffffffff")
|
||||
create expected.make_from_integer (0x1)
|
||||
powm (one, two, three, four)
|
||||
assert ("test powm 2", one ~ expected)
|
||||
end
|
||||
|
||||
test_probably_prime_isprime_1
|
||||
local
|
||||
val: BOOLEAN
|
||||
do
|
||||
val := probab_prime_isprime (0x25)
|
||||
assert ("test probably_prime_isprime 1", val)
|
||||
end
|
||||
|
||||
test_probably_prime_isprime_2
|
||||
local
|
||||
val: BOOLEAN
|
||||
do
|
||||
val := probab_prime_isprime (0x31)
|
||||
assert ("test probably_prime_isprime 2", not val)
|
||||
end
|
||||
end
|
||||
82
contrib/ise_library/math/eapml/tests/test_integer_x_random.e
Normal file
82
contrib/ise_library/math/eapml/tests/test_integer_x_random.e
Normal file
@@ -0,0 +1,82 @@
|
||||
note
|
||||
description: "Summary description for {TEST_INTEGER_X_RANDOM}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_INTEGER_X_RANDOM
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
INTEGER_X_RANDOM
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_urandomm_1
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: MERSENNE_TWISTER_RNG
|
||||
three: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make
|
||||
create three.make_from_hex_string ("1000 0000 0000 0000 0000 0000 0000 0000")
|
||||
urandomm (one, two, three)
|
||||
assert ("test urandomm 1", one.item [0] = 0x39bca874 and one.item [1] = 0x58d2754b and one.item [2] = 0x82902d2f and one.item [3] = 0x0647f3c3)
|
||||
end
|
||||
|
||||
test_urandomm_2
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: MERSENNE_TWISTER_RNG
|
||||
three: INTEGER_X
|
||||
i: INTEGER
|
||||
do
|
||||
create one
|
||||
create two.make
|
||||
create three.make_from_hex_string ("1000 0000 0000 0000 0000 0000 0000 0000")
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
i = 1000
|
||||
loop
|
||||
urandomm (one, two, three)
|
||||
i := i + 1
|
||||
end
|
||||
assert ("test urandomm 2", one.item [0] = 0x620764dc and one.item [1] = 0xe1fff273 and one.item [2] = 0x6a24317d and one.item [3] = 0x05d87e21)
|
||||
end
|
||||
|
||||
test_urandomm_3
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: MERSENNE_TWISTER_RNG
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make
|
||||
create three.make_from_hex_string ("1 00000000 00000000 0001b8fa 16dfab9a ca16b6b3")
|
||||
create expected.make_from_hex_string ("72a8d0a2 fd530069 2ab48f9e f732f5c3 fa212b90")
|
||||
urandomm (one, two, three)
|
||||
assert ("test urandomm 3", one ~ expected)
|
||||
end
|
||||
|
||||
test_urandomm_4
|
||||
local
|
||||
one: INTEGER_X
|
||||
two: LINEAR_CONGRUENTIAL_RNG
|
||||
three: INTEGER_X
|
||||
expected: INTEGER_X
|
||||
do
|
||||
create one
|
||||
create two.make (32)
|
||||
create three.make_from_hex_string ("1 00000000 00000000 0001b8fa 16dfab9a ca16b6b3")
|
||||
create expected.make_from_hex_string ("d960a1bf 841fd605 99811941 a122cb1a 323a7636")
|
||||
urandomm (one, two, three)
|
||||
assert ("test urandomm 4", one ~ expected)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,37 @@
|
||||
note
|
||||
description: "Summary description for {TEST_LIMB_MANIPULATION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_LIMB_MANIPULATION
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
LIMB_MANIPULATION
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_modlimb_inverse_1
|
||||
local
|
||||
inverse: NATURAL_32
|
||||
do
|
||||
inverse := modlimb_invert (0x7fffffff)
|
||||
assert ("test limb inverse 1", inverse = 0x7fffffff)
|
||||
end
|
||||
|
||||
test_extract_limb_left_1
|
||||
local
|
||||
one: NATURAL_32
|
||||
two: NATURAL_32
|
||||
val: NATURAL_32
|
||||
do
|
||||
one := 0x13579bdf
|
||||
two := 0x2468ace0
|
||||
val := extract_limb (8, one, two)
|
||||
assert ("test exctact limb left 1", val = 0x579bdf24)
|
||||
end
|
||||
end
|
||||
85
contrib/ise_library/math/eapml/tests/test_randstruct_lc.e
Normal file
85
contrib/ise_library/math/eapml/tests/test_randstruct_lc.e
Normal file
@@ -0,0 +1,85 @@
|
||||
note
|
||||
description: "Summary description for {TEST_RANDSTRUCT_LC}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_RANDSTRUCT_LC
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
INTEGER_X_FACILITIES
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_randget_1
|
||||
local
|
||||
struct: LINEAR_CONGRUENTIAL_RNG
|
||||
target: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create struct.make (16)
|
||||
create target.make_filled (0, 16)
|
||||
struct.randget (target, 0, 16 * 32)
|
||||
assert ("test randget 1 1", target [0] = 0x9a13029c and target [1] = 0xa57f74f1 and target [2] = 0x4978d92b and target [3] = 0xfcd3c783)
|
||||
assert ("test randget 1 2", target [4] = 0xc6815ba3 and target [5] = 0xd1c1fccc and target [6] = 0xdce6db9b and target [7] = 0xab842185)
|
||||
assert ("test randget 1 3", target [8] = 0x7561a561 and target [9] = 0xd97b558c and target [10] = 0x38fe3b9c and target [11] = 0x18105699)
|
||||
assert ("test randget 1 4", target [12] = 0x4aa55829 and target [13] = 0xd9eae640 and target [14] = 0xc2e62e2f and target [15] = 0x8157a727)
|
||||
end
|
||||
|
||||
test_randget_2
|
||||
local
|
||||
struct: LINEAR_CONGRUENTIAL_RNG
|
||||
target: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create struct.make (128)
|
||||
create target.make_filled (0, 16)
|
||||
struct.randget (target, 0, 16 * 32)
|
||||
assert ("test randget 2 1", target [0] = 0x42a99a0c and target [1] = 0x71fd8f07 and target [2] = 0x2aaf58a0 and target [3] = 0xaf66ba93)
|
||||
assert ("test randget 2 2", target [4] = 0xec6b8425 and target [5] = 0x3507ca60 and target [6] = 0x64c9c175 and target [7] = 0x73cfa3c6)
|
||||
assert ("test randget 2 3", target [8] = 0xa8e20278 and target [9] = 0x2cd68b8a and target [10] = 0xa131dec1 and target [11] = 0x53ea074c)
|
||||
assert ("test randget 2 4", target [12] = 0x47581f73 and target [13] = 0xa53cc0eb and target [14] = 0x343532f8 and target [15] = 0x3cf5ac8c)
|
||||
end
|
||||
|
||||
test_randget_3
|
||||
local
|
||||
struct: LINEAR_CONGRUENTIAL_RNG
|
||||
target: SPECIAL [NATURAL_32]
|
||||
i: INTEGER
|
||||
do
|
||||
create struct.make (128)
|
||||
create target.make_filled (0, 4)
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
i = 1_000
|
||||
loop
|
||||
struct.randget (target, 0, 4 * 32)
|
||||
i := i + 1
|
||||
end
|
||||
assert ("test randget 3", target [0] = 0x6cb70ec0 and target [1] = 0x7e6c8a80 and target [2] = 0x314b0a1c and target [3] = 0xf4f389af)
|
||||
end
|
||||
|
||||
test_randget_4
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
struct: LINEAR_CONGRUENTIAL_RNG
|
||||
do
|
||||
create one.make_filled (0, 6)
|
||||
create struct.make (32)
|
||||
struct.randget (one, 0, 0xa1)
|
||||
assert ("test randget 4 1", one [0] = 0xbaecd515 and one [1] = 0x13ae8ec6 and one [2] = 0x518c8090 and one [3] = 0x881ca077 and one [4] = 0x870b7134 and one [5] = 0x00000001)
|
||||
struct.randget (one, 0, 0xa1)
|
||||
assert ("test randget 4 2", one [0] = 0x323a7636 and one [1] = 0xa122cb1a and one [2] = 0x99811941 and one [3] = 0x841fd605 and one [4] = 0xd960a1bf and one [5] = 0x0)
|
||||
end
|
||||
|
||||
test_make_1
|
||||
local
|
||||
struct: LINEAR_CONGRUENTIAL_RNG
|
||||
do
|
||||
create struct.make (32)
|
||||
assert ("test make 1", struct.seed.seed.capacity = 2)
|
||||
end
|
||||
end
|
||||
46
contrib/ise_library/math/eapml/tests/test_randstruct_mt.e
Normal file
46
contrib/ise_library/math/eapml/tests/test_randstruct_mt.e
Normal file
@@ -0,0 +1,46 @@
|
||||
note
|
||||
description: "Summary description for {TEST_RANDSTRUCT_MT}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_RANDSTRUCT_MT
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
|
||||
feature
|
||||
test_randget_1
|
||||
local
|
||||
one: MERSENNE_TWISTER_RNG
|
||||
target: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make
|
||||
create target.make_filled (0, 16)
|
||||
one.randget (target, 0, 16 * 32)
|
||||
assert ("test randget 1 1", target [0] = 0x39bca874 and target [1] = 0x58d2754b and target [2] = 0x82902d2f and target [3] = 0x7647f3c3)
|
||||
assert ("test randget 1 2", target [4] = 0x680bbdc8 and target [5] = 0x14b9c0e1 and target [6] = 0xd84a873b and target [7] = 0x6580d17d)
|
||||
assert ("test randget 1 3", target [8] = 0xbf767863 and target [9] = 0x1eff7e89 and target [10] = 0xaa3dc18b and target [11] = 0x3c0d9fcf)
|
||||
assert ("test randget 1 4", target [12] = 0x7a337236 and target [13] = 0xf58174d5 and target [14] = 0x6846aeb6 and target [15] = 0x18f204fe)
|
||||
end
|
||||
|
||||
test_randget_2
|
||||
local
|
||||
one: MERSENNE_TWISTER_RNG
|
||||
target: SPECIAL [NATURAL_32]
|
||||
i: INTEGER
|
||||
do
|
||||
create one.make
|
||||
create target.make_filled (0, 4)
|
||||
from
|
||||
i := 0
|
||||
until
|
||||
i >= 1_000
|
||||
loop
|
||||
one.randget (target, 0, 4 * 32)
|
||||
i := i + 1
|
||||
end
|
||||
assert ("test randget 2", target [0] = 0x620764dc and target [1] = 0xe1fff273 and target [2] = 0x6a24317d and target [3] = 0x65d87e21)
|
||||
end
|
||||
end
|
||||
463
contrib/ise_library/math/eapml/tests/test_special_arithmetic.e
Normal file
463
contrib/ise_library/math/eapml/tests/test_special_arithmetic.e
Normal file
@@ -0,0 +1,463 @@
|
||||
note
|
||||
description: "Summary description for {TEST_NUMBER_ARITHMETIC}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_SPECIAL_ARITHMETIC
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
SPECIAL_COMPARISON
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
SPECIAL_ARITHMETIC
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_add_1_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 4)
|
||||
add_1 (item, 0, one, 0, 4, 1, carry)
|
||||
assert ("Test add 1 1", item [0] = 0 and item [1] = 0 and item [2] = 0 and item [3] = 0 and carry.item = 1)
|
||||
end
|
||||
|
||||
test_add_1_2
|
||||
local
|
||||
item: SPECIAL [NATURAL_32]
|
||||
junk: CELL [NATURAL_32]
|
||||
do
|
||||
create junk.put (0)
|
||||
create item.make_filled (0, 2)
|
||||
item [0] := 0xcb101a11
|
||||
item [1] := 0xf00635d0
|
||||
add_1 (item, 0, item, 0, 2, 0x57cc11df, junk)
|
||||
assert ("test add 1 2", item [0] = 0x22dc2bf0 and item [1] = 0xf00635d1 and junk.item = 0)
|
||||
end
|
||||
|
||||
test_add_1_3
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
junk: CELL [NATURAL_32]
|
||||
do
|
||||
create junk.put (0)
|
||||
create one.make_filled (0, 4)
|
||||
create two.make_filled (0, 2)
|
||||
one [0] := 0xeeeeeeee
|
||||
one [1] := 0xeeeeeeee
|
||||
two [0] := 0xeeeeeeee
|
||||
add_1 (one, 2, two, 1, 1, 0, junk)
|
||||
assert ("test add 1 3", one [0] = 0xeeeeeeee and one [1] = 0xeeeeeeee and one [2] = 0x0 and one [3] = 0x0 and two [0] = 0xeeeeeeee and two [1] = 0x0 and junk.item = 0)
|
||||
end
|
||||
|
||||
test_add_1_4
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 4)
|
||||
add_1 (item, 0, one, 0, 4, 1, carry)
|
||||
assert ("Test add 1 4 1", item [0] = 0 and item [1] = 0 and item [2] = 0 and item [3] = 0 and carry.item = 1)
|
||||
add_1 (item, 0, one, 0, 4, 0, carry)
|
||||
assert ("Test add 1 4 2", item [0] = 0xffffffff and item [1] = 0xffffffff and item [2] = 0xffffffff and item [3] = 0xffffffff and carry.item = 0)
|
||||
end
|
||||
|
||||
test_add_n
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create item.make_filled (0, 4)
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create two.make_filled (0, 4)
|
||||
one [3] := 0x0
|
||||
two [0] := 0x1
|
||||
add_n (item, 0, one, 0, two, 0, 4, carry)
|
||||
assert ("Test add n", item [0] = 0 and item [1] = 0 and item [2] = 0 and item [3] = 1 and carry.item = 0)
|
||||
end
|
||||
|
||||
test_add_n_carry
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create item.make_filled (0, 4)
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create two.make_filled (0, 4)
|
||||
two [0] := 0x1
|
||||
add_n (item, 0, one, 0, two, 0, 4, carry)
|
||||
assert ("Test add n", item [0] = 0 and item [1] = 0 and item [2] = 0 and item [3] = 0 and carry.item = 1)
|
||||
end
|
||||
|
||||
test_add_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create item.make_filled (0, 4)
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create two.make_filled (0, 4)
|
||||
one [3] := 0x0
|
||||
two [0] := 0x1
|
||||
add (item, 0, one, 0, one.count, two, 0, two.count, carry)
|
||||
assert ("Test add n", item [0] = 0 and item [1] = 0 and item [2] = 0 and item [3] = 1 and carry.item = 0)
|
||||
end
|
||||
|
||||
test_add_2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create one.make_filled (0, 0xb)
|
||||
create two.make_filled (0, 0xa)
|
||||
create three.make_filled (0, 0x5)
|
||||
two [0] := 0xee98e4a2
|
||||
two [1] := 0x8aec1812
|
||||
two [2] := 0xfc43f9bb
|
||||
two [3] := 0x70d1ccc8
|
||||
two [4] := 0xc122bf19
|
||||
two [5] := 0xeb356bfb
|
||||
two [6] := 0x77f53c1f
|
||||
two [7] := 0xac9b2b87
|
||||
two [8] := 0x13524c02
|
||||
two [9] := 0x89136811
|
||||
three [0] := 0x9cd0d89d
|
||||
three [1] := 0x7850c26c
|
||||
three [2] := 0xba3e2571
|
||||
three [3] := 0x4706816a
|
||||
three [4] := 0xa9993e36
|
||||
add (one, 0, two, 0, 0xa, three, 0, 0x5, carry)
|
||||
assert ("test add 2", carry.item = 0 and one [0] = 0x8b69bd3f and one [1] = 0x033cda7f and one [2] = 0xb6821f2d and one [3] = 0xb7d84e33 and one [4] = 0x6abbfd4f and one [5] = 0xeb356bfc and one [6] = 0x77f53c1f and one [7] = 0xac9b2b87 and one [8] = 0x13524c02 and one [9] = 0x89136811)
|
||||
end
|
||||
|
||||
test_cmp_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
comp: INTEGER_32
|
||||
do
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create two.make_filled (0x90000000, 4)
|
||||
comp := cmp (one, 0, two, 0, 4)
|
||||
assert ("Test cmp 1", comp = 1)
|
||||
end
|
||||
|
||||
test_cmp_2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
comp: INTEGER_32
|
||||
do
|
||||
create one.make_filled (0x90000000, 4)
|
||||
create two.make_filled (0xffffffff, 4)
|
||||
comp := cmp (one, 0, two, 0, 4)
|
||||
assert ("Test cmp 2", comp = -1)
|
||||
end
|
||||
|
||||
test_cmp_3
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
comp: INTEGER_32
|
||||
do
|
||||
create one.make_filled (0x80000000, 4)
|
||||
create two.make_filled (0x80000000, 4)
|
||||
assert ("Test cmp 3", comp = 0)
|
||||
end
|
||||
|
||||
test_mul_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create item.make_filled (0, 4)
|
||||
create one.make_filled (1, 4)
|
||||
mul_1 (item, 0, one, 0, 4, 2, carry)
|
||||
assert ("Test mul 1", item [0] = 2 and item [1] = 2 and item [2] = 2 and item [3] = 2 and carry.item = 0)
|
||||
create item.make_filled (0, 4)
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
mul_1 (item, 0, one, 0, 4, 0xffffffff, carry)
|
||||
assert ("Test mul 1", item [0] = 0x1 and item [1] = 0xffffffff and item [2] = 0xffffffff and item [3] = 0xffffffff and carry.item = 0xfffffffe)
|
||||
end
|
||||
|
||||
test_mul_1_offsets
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create item.make_filled (0, 6)
|
||||
create one.make_filled (1, 6)
|
||||
item [0] := 0x10101010
|
||||
item [5] := 0x10101010
|
||||
mul_1 (item, 1, one, 1, 4, 2, carry)
|
||||
assert ("Test mul 1 offsets", item [0] = 0x10101010 and item [1] = 2 and item [2] = 2 and item [3] = 2 and item [4] = 2 and item [5] = 0x10101010 and carry.item = 0)
|
||||
create item.make_filled (0, 6)
|
||||
create one.make_filled (0xffffffff, 6)
|
||||
item [0] := 0x10101010
|
||||
item [5] := 0x10101010
|
||||
mul_1 (item, 1, one, 1, 4, 0xffffffff, carry)
|
||||
assert ("Test mul 1 offsets", item [0] = 0x10101010 and item [1] = 1 and item [2] = 0xffffffff and item [3] = 0xffffffff and item [4] = 0xffffffff and item [5] = 0x10101010 and carry.item = 0xfffffffe)
|
||||
end
|
||||
|
||||
test_mul_n_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
target: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x77777777, 4)
|
||||
create two.make_filled (0x0, 4)
|
||||
two [0] := 0x2
|
||||
create target.make_filled (0, 8)
|
||||
mul_n (target, 0, one, 0, two, 0, 4)
|
||||
assert ("test mul n 1", target [0] = 0xeeeeeeee and target [1] = 0xeeeeeeee and target [2] = 0xeeeeeeee and target [3] = 0xeeeeeeee and target [4] = 0x0 and target [5] = 0x0 and target [6] = 0x0 and target [7] = 0x0)
|
||||
end
|
||||
|
||||
test_mul_basecase_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create item.make_filled (0, 8)
|
||||
create one.make_filled (4, 4)
|
||||
create two.make_filled (4, 4)
|
||||
mul_basecase (item, 0, one, 0, one.count, two, 0, two.count)
|
||||
assert ("test mul basecase", item [0] = 0x10 and item [1] = 0x20 and item [2] = 0x30 and item [3] = 0x40 and item [4] = 0x30 and item [5] = 0x20 and item [6] = 0x10 and item [7] = 0x0)
|
||||
end
|
||||
|
||||
test_sqr
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 8)
|
||||
sqr_n (item, 0, one, 0, 4)
|
||||
assert ("test sqr", item [0] = 0x00000001 and item [1] = 0x0 and item [2] = 0x0 and item [3] = 0x0 and item [4] = 0xfffffffe and item [5] = 0xffffffff and item [6] = 0xffffffff and item [7] = 0xffffffff)
|
||||
end
|
||||
|
||||
test_sub_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
borrow: CELL [NATURAL_32]
|
||||
do
|
||||
create borrow.put (0)
|
||||
create one.make_filled (0, 0x12)
|
||||
create two.make_filled (0xffffffff, 0x11)
|
||||
two [0x10] := 0x000001ff
|
||||
create three.make_filled (0, 0x10)
|
||||
three [0] := 0x9e76fb15
|
||||
three [1] := 0x32e4e606
|
||||
three [2] := 0xb6d93fcc
|
||||
three [3] := 0x621dd631
|
||||
three [4] := 0xa3a1f005
|
||||
three [5] := 0x19f28b09
|
||||
three [6] := 0x19a6800c
|
||||
three [7] := 0xaf6e5a54
|
||||
three [8] := 0x37fae053
|
||||
three [9] := 0xad460fb3
|
||||
three [10] := 0xfb2a9d7c
|
||||
three [11] := 0x9947e909
|
||||
three [12] := 0x2a7e14c9
|
||||
three [13] := 0xce163d50
|
||||
three [14] := 0x689f4fd7
|
||||
three [15] := 0x7231ea35
|
||||
sub (one, 0, two, 0, 0x11, three, 0, 0x10, borrow)
|
||||
assert ("test sub 1 1", borrow.item = 0 and one [0] = 0x618904ea and one [1] = 0xcd1b19f9 and one [2] = 0x4926c033 and one [3] = 0x9de229ce)
|
||||
assert ("test sub 1 2", one [4] = 0x5c5e0ffa and one [5] = 0xe60d74f6 and one [6] = 0xe6597ff3 and one [7] = 0x5091a5ab)
|
||||
assert ("test sub 1 3", one [8] = 0xc8051fac and one [9] = 0x52b9f04c and one [10] = 0x04d56283 and one [11] = 0x66b816f6)
|
||||
assert ("test sub 1 4", one [12] = 0xd581eb36 and one [13] = 0x31e9c2af and one [14] = 0x9760b028 and one [15] = 0x8dce15ca and one [16] = 0x000001ff)
|
||||
end
|
||||
|
||||
test_sub_1_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create one.make_filled (0x11111111, 4)
|
||||
sub_1 (one, 0 + 2, one, 0 + 2, 2, 0, carry)
|
||||
assert ("test sub 1", one [0] = 0x11111111 and one [1] = 0x11111111 and one [2] = 0x11111111 and one [3] = 0x11111111 and carry.item = 0x0)
|
||||
end
|
||||
|
||||
test_sub_1_2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create one.make_filled (0, 4)
|
||||
sub_1 (one, 3, one, 3, 1, 0, carry)
|
||||
assert ("Test sub 1 2", one [0] = 0x0 and one [1] = 0x0 and one [2] = 0x0 and one [3] = 0x0 and carry.item = 0x0)
|
||||
end
|
||||
|
||||
test_sub_n
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create item.make_filled (0, 4)
|
||||
create one.make_filled (0, 4)
|
||||
create two.make_filled (0, 4)
|
||||
two [0] := 1
|
||||
sub_n (item, 0, one, 0, two, 0, 4, carry)
|
||||
assert ("Test sub", item [0] = 0xffffffff and item [1] = 0xffffffff and item [2] = 0xffffffff and item [3] = 0xffffffff and carry.item = 1)
|
||||
end
|
||||
|
||||
test_incr_u
|
||||
local
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create item.make_filled (0xffffffff, 4)
|
||||
item [3] := 0
|
||||
incr_u (item, 0, 1)
|
||||
assert ("Test incr u", item [0] = 0x0 and item [1] = 0x0 and item [2] = 0x0 and item [3] = 0x1)
|
||||
end
|
||||
|
||||
big_one: SPECIAL [NATURAL_32]
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 65)
|
||||
one [0] := 0xffffffff one [1] := 0xffffffff one [2] := 0xffffffff one [3] := 0xffffffff
|
||||
one [4] := 0xffffffff one [5] := 0xffffffff one [6] := 0xffffffff one [7] := 0x3fffffff
|
||||
--
|
||||
one [36] := 0x00000000 one [37] := 0x00000000 one [38] := 0xc0000000 one [39] := 0xffffffff
|
||||
one [40] := 0xffffffff one [41] := 0xffffffff one [42] := 0xffffffff one [43] := 0xffffffff
|
||||
one [44] := 0xffffffff one [45] := 0xffffffff one [46] := 0xffffffff one [47] := 0xffffffff
|
||||
one [48] := 0xffffffff one [49] := 0xffffffff one [50] := 0xffffffff one [51] := 0xffffffff
|
||||
one [52] := 0xffffffff one [53] := 0xffffffff one [54] := 0xffffffff one [55] := 0xffffffff
|
||||
one [56] := 0xffffffff one [57] := 0x01ffffff one [58] := 0x00000000 one [59] := 0x00000000
|
||||
one [63] := 0xffffffff one [64] := 0xffffffff
|
||||
|
||||
Result := one
|
||||
end
|
||||
|
||||
big_two: SPECIAL [NATURAL_32]
|
||||
local
|
||||
two: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create two.make_filled (0, 65)
|
||||
two [0] := 0xffffffff
|
||||
two [40] := 0x00000000 two [41] := 0x00000000 two [42] := 0x00000000 two [43] := 0xfff80000
|
||||
two [44] := 0xffffffff two [45] := 0xffffffff two [46] := 0xffffffff two [47] := 0xffffffff
|
||||
two [48] := 0xffffffff two [49] := 0xffffffff two [50] := 0xffffffff two [51] := 0xffffffff
|
||||
two [52] := 0xffffffff two [53] := 0xffffffff two [54] := 0xffffffff two [55] := 0xffffffff
|
||||
two [56] := 0xffffffff two [57] := 0xffffffff two [58] := 0xffffffff two [59] := 0xffffffff
|
||||
two [60] := 0xffffffff two [61] := 0xffffffff two [62] := 0xffffffff two [63] := 0xffffffff
|
||||
two [64] := 0xffffffff
|
||||
|
||||
Result := two
|
||||
end
|
||||
|
||||
test_kara_n_odd
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
ref: SPECIAL [NATURAL_32]
|
||||
workspace: SPECIAL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
one := big_one
|
||||
two := big_two
|
||||
create ref.make_filled (0, 130)
|
||||
ref [0] := 0x00000001 ref [1] := 0xffffffff ref [2] := 0xffffffff ref [3] := 0xffffffff
|
||||
ref [4] := 0xffffffff ref [5] := 0xffffffff ref [6] := 0xffffffff ref [7] := 0xbfffffff
|
||||
ref [8] := 0x3fffffff
|
||||
ref [36] := 0x00000000 ref [37] := 0x00000000 ref [38] := 0x40000000 ref [39] := 0xc0000000
|
||||
ref [40] := 0xffffffff ref [41] := 0xffffffff ref [42] := 0xffffffff ref [43] := 0x0007ffff
|
||||
ref [48] := 0x00000000 ref [49] := 0x00000000 ref [50] := 0x00000000 ref [51] := 0xfffe0000
|
||||
ref [52] := 0xffffffff ref [53] := 0xffffffff ref [54] := 0xffffffff ref [55] := 0xffffffff
|
||||
ref [56] := 0xffffffff ref [57] := 0xfdffffff ref [58] := 0x01ffffff
|
||||
ref [60] := 0x00000000 ref [61] := 0x00000000 ref [62] := 0x00000000 ref [63] := 0x00000001
|
||||
ref [64] := 0xffffffff ref [65] := 0xfffffffd
|
||||
ref [72] := 0x40000000
|
||||
ref [80] := 0x00000000 ref [81] := 0x00000000 ref [82] := 0x00020000
|
||||
ref [100] := 0x00000000 ref [101] := 0xfffff000 ref [102] := 0xffffffff ref [103] := 0xbfffffff
|
||||
ref [104] := 0xffffffff ref [105] := 0xffffffff ref [106] := 0x0007ffff ref [107] := 0x00000000
|
||||
ref [108] := 0xfff80000 ref [109] := 0xffffffff ref [110] := 0xffffffff ref [111] := 0xffffffff
|
||||
ref [112] := 0xffffffff ref [113] := 0xffffffff ref [114] := 0xffffffff ref [115] := 0xffffffff
|
||||
ref [116] := 0xffffffff ref [117] := 0xffffffff ref [118] := 0xffffffff ref [119] := 0xffffffff
|
||||
ref [120] := 0xffffffff ref [121] := 0xffffffff ref [122] := 0x01ffffff
|
||||
ref [124] := 0x00000000 ref [125] := 0x00000000 ref [126] := 0x00000000 ref [127] := 0x00000000
|
||||
ref [128] := 0xffffffff ref [129] := 0xffffffff
|
||||
|
||||
create workspace.make_filled (0, 2 * 65 + 2 * 32)
|
||||
create item.make_filled (0, 65 + 65)
|
||||
kara_mul_n (item, 0, one, 0, two, 0, 65, workspace, 0)
|
||||
assert ("Test kara mul n odd", item.same_items (ref, 0, 0, ref.count))
|
||||
end
|
||||
|
||||
test_kara_n
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
ref: SPECIAL [NATURAL_32]
|
||||
workspace: SPECIAL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
one := big_one
|
||||
two := big_two
|
||||
create ref.make_filled (0, 128)
|
||||
ref [0] := 0x00000001 ref [1] := 0xffffffff ref [2] := 0xffffffff ref [3] := 0xffffffff
|
||||
ref [4] := 0xffffffff ref [5] := 0xffffffff ref [6] := 0xffffffff ref [7] := 0xbfffffff
|
||||
ref [8] := 0x3fffffff
|
||||
ref [36] := 0x00000000 ref [37] := 0x00000000 ref [38] := 0x40000000 ref [39] := 0xc0000000
|
||||
ref [40] := 0xffffffff ref [41] := 0xffffffff ref [42] := 0xffffffff ref [43] := 0x0007ffff
|
||||
ref [48] := 0x00000000 ref [49] := 0x00000000 ref [50] := 0x00000000 ref [51] := 0xfffe0000
|
||||
ref [52] := 0xffffffff ref [53] := 0xffffffff ref [54] := 0xffffffff ref [55] := 0xffffffff
|
||||
ref [56] := 0xffffffff ref [57] := 0xfdffffff ref [58] := 0x01ffffff
|
||||
ref [60] := 0x00000000 ref [61] := 0x00000000 ref [62] := 0x00000000 ref [63] := 0x00000001
|
||||
ref [64] := 0xfffffffd
|
||||
ref [68] := 0x00000000 ref [69] := 0x00000000 ref [70] := 0x00000000 ref [71] := 0x40000000
|
||||
ref [80] := 0x00000000 ref [81] := 0x00000000 ref [82] := 0x00020000
|
||||
ref [100] := 0x00000000 ref [101] := 0xfffff000 ref [102] := 0xbfffffff ref [103] := 0xffffffff
|
||||
ref [104] := 0xffffffff ref [105] := 0xffffffff ref [106] := 0x0007ffff ref [107] := 0xfff80000
|
||||
ref [108] := 0xffffffff ref [109] := 0xffffffff ref [110] := 0xffffffff ref [111] := 0xffffffff
|
||||
ref [112] := 0xffffffff ref [113] := 0xffffffff ref [114] := 0xffffffff ref [115] := 0xffffffff
|
||||
ref [116] := 0xffffffff ref [117] := 0xffffffff ref [118] := 0xffffffff ref [119] := 0xffffffff
|
||||
ref [120] := 0xffffffff ref [121] := 0x01ffffff
|
||||
ref [124] := 0x00000000 ref [125] := 0x00000000 ref [126] := 0x00000000 ref [127] := 0xffffffff
|
||||
|
||||
create workspace.make_filled (0, 2 * 64 + 2 * 32)
|
||||
create item.make_filled (0, 64 + 64)
|
||||
kara_mul_n (item, 0, one, 0, two, 0, 64, workspace, 0)
|
||||
assert ("Test kara mul n", item.same_items (ref, 0, 0, ref.count))
|
||||
end
|
||||
end
|
||||
458
contrib/ise_library/math/eapml/tests/test_special_division.e
Normal file
458
contrib/ise_library/math/eapml/tests/test_special_division.e
Normal file
@@ -0,0 +1,458 @@
|
||||
note
|
||||
description: "Summary description for {TEST_NUMBER_DIVISION}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_SPECIAL_DIVISION
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
EXCEPTION_MANAGER
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
SPECIAL_DIVISION
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_tdiv_qr_div_0
|
||||
local
|
||||
divide_zero_exception: TUPLE [divide_zero_exception: BOOLEAN]
|
||||
do
|
||||
create divide_zero_exception
|
||||
divide_func (divide_zero_exception)
|
||||
assert ("test tdiv qr div 0", divide_zero_exception.divide_zero_exception)
|
||||
end
|
||||
|
||||
divide_func (divide_zero_exception: TUPLE [divide_zero_exception: BOOLEAN])
|
||||
local
|
||||
retried: BOOLEAN
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
if not retried then
|
||||
create item.make_filled (0, 1)
|
||||
create one.make_filled (0, 1)
|
||||
create two.make_filled (0, 1)
|
||||
create three.make_filled (0, 1)
|
||||
tdiv_qr (item, 0, one, 0, two, 0, 1, three, 0, 0)
|
||||
end
|
||||
rescue
|
||||
retried := True
|
||||
if attached {DIVIDE_BY_ZERO} last_exception then
|
||||
divide_zero_exception.divide_zero_exception := True
|
||||
end
|
||||
retry
|
||||
end
|
||||
|
||||
test_tdiv_qr_div_1_1
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
remainder: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0xffffffff, 4)
|
||||
create denominator.make_filled (0x77777777, 1)
|
||||
create quotient.make_filled (0, 4)
|
||||
create remainder.make_filled (0, 1)
|
||||
tdiv_qr (quotient, 0, remainder, 0, numerator, 0, 4, denominator, 0, 1)
|
||||
assert ("tdiv qr div 1 1", quotient [0] = 0x00000002 and quotient [1] = 0xb6db6db9 and quotient [2] = 0x24924926 and quotient [3] = 0x00000002 and remainder [0] = 0x11111111)
|
||||
end
|
||||
|
||||
test_tdiv_qr_div_2_1
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
remainder: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0xffffffff, 4)
|
||||
create denominator.make_filled (0x77777777, 2)
|
||||
create quotient.make_filled (0, 4)
|
||||
create remainder.make_filled (0, 2)
|
||||
tdiv_qr (quotient, 0, remainder, 0, numerator, 0, 4, denominator, 0, 2)
|
||||
assert ("test tdiv qr div 2 1 quotient", quotient [0] = 0x92492494 and quotient [1] = 0x24924924 and quotient [2] = 0x00000002 and quotient [3] = 0x0)
|
||||
assert ("test tdiv qr div 2 1 remainder", remainder [0] = 0x33333333 and remainder [1] = 0x33333333)
|
||||
end
|
||||
|
||||
test_tdiv_qr_div_big_1
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
remainder: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0xffffffff, 4)
|
||||
create denominator.make_filled (0x77777777, 3)
|
||||
create quotient.make_filled (0, 4)
|
||||
create remainder.make_filled (0, 3)
|
||||
tdiv_qr (quotient, 0, remainder, 0, numerator, 0, 4, denominator, 0, 3)
|
||||
assert ("test tdiv qr div big 1 quotient", quotient [0] = 0x24924924 and quotient [1] = 0x00000002 and quotient [2] = 0x0 and quotient [3] = 0x0)
|
||||
assert ("test tdiv qr div big 1 remainder", remainder [0] = 0x44444443 and remainder [1] = 0x44444445 and remainder [2] = 0x44444444)
|
||||
end
|
||||
|
||||
test_tdiv_qr_div_big_2
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
remainder: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0xffffffff, 4)
|
||||
create denominator.make_filled (0x77777777, 4)
|
||||
create quotient.make_filled (0, 4)
|
||||
create remainder.make_filled (0, 4)
|
||||
tdiv_qr (quotient, 0, remainder, 0, numerator, 0, 4, denominator, 0, 4)
|
||||
assert ("test tdiv qr div big 2 quotient", quotient [0] = 0x000000002 and quotient [1] = 0x00000000 and quotient [2] = 0x00000000 and quotient [3] = 0x00000000)
|
||||
assert ("test tdiv qr div big 2 remainder", remainder [0] = 0x11111111 and remainder [1] = 0x11111111 and remainder [2] = 0x11111111 and remainder [3] = 0x11111111)
|
||||
end
|
||||
|
||||
test_tdiv_qr_div_big_3
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
remainder: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0xffffffff, 4)
|
||||
create denominator.make_filled (0x77777777, 4)
|
||||
create quotient.make_filled (0x0, 4)
|
||||
create remainder.make_filled (0x0, 4)
|
||||
numerator [3] := 0
|
||||
tdiv_qr (quotient, 0, remainder, 0, numerator, 0, 4, denominator, 0, 4)
|
||||
assert ("test tdiv qr div big 3 quotient", quotient [0] = 0x00000000 and quotient [1] = 0x00000000 and quotient [2] = 0x00000000)
|
||||
assert ("test tdiv qr div big 3 remainder", remainder [0] = 0xffffffff and remainder [1] = 0xffffffff and remainder [2] = 0xffffffff and remainder [3] = 0x0)
|
||||
end
|
||||
|
||||
test_tdiv_qr_div_big_4
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
remainder: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0x80000000, 4)
|
||||
create denominator.make_filled (0x80000000, 4)
|
||||
create quotient.make_filled (0, 4)
|
||||
create remainder.make_filled (0, 4)
|
||||
tdiv_qr (quotient, 0, remainder, 0, numerator, 0, 4, denominator, 0, 4)
|
||||
assert ("test tdiv qr div big 4 quotient", quotient [0] = 0x1 and quotient [1] = 0x0 and quotient [2] = 0x0 and quotient [3] = 0x0)
|
||||
assert ("test tdiv qr div big 4 remainder", remainder [0] = 0x0 and remainder [1] = 0x0 and remainder [2] = 0x0 and remainder [3] = 0x0)
|
||||
end
|
||||
|
||||
test_tdiv_qr_div_big_5
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
remainder: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0x80000000, 4)
|
||||
create denominator.make_filled (0x80000000, 4)
|
||||
create quotient.make_filled (0, 4)
|
||||
remainder := numerator
|
||||
tdiv_qr (quotient, 0, remainder, 0, numerator, 0, 4, denominator, 0, 4)
|
||||
assert ("test tdiv qr div big 4 quotient", quotient [0] = 0x1 and quotient [1] = 0x0 and quotient [2] = 0x0 and quotient [3] = 0x0)
|
||||
assert ("test tdiv qr div big 4 remainder", remainder [0] = 0x0 and remainder [1] = 0x0 and remainder [2] = 0x0 and remainder [3] = 0x0)
|
||||
end
|
||||
|
||||
test_tdiv_qr_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
four: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 6)
|
||||
create two.make_filled (0, 5)
|
||||
create three.make_filled (0, 10)
|
||||
create four.make_filled (0, 5)
|
||||
three [0] := 0x9ee82ea8
|
||||
three [1] := 0x90eb9c01
|
||||
three [2] := 0x564096ef
|
||||
three [3] := 0x14156137
|
||||
three [4] := 0xd359cd33
|
||||
three [5] := 0xe06ffa35
|
||||
three [6] := 0xfe887b52
|
||||
three [7] := 0x2a7b2b66
|
||||
three [8] := 0x56ad0915
|
||||
three [9] := 0x014fae42
|
||||
four [0] := 0xf58bf664
|
||||
four [1] := 0x0846a26e
|
||||
four [2] := 0xb3b99224
|
||||
four [3] := 0x62d128fa
|
||||
four [4] := 0x474c50aa
|
||||
tdiv_qr (one, 0, two, 0, three, 0, 10, four, 0, 5)
|
||||
assert ("test tdiv qr 1 1", one [0] = 0x9019af3a and one [1] = 0x998d2570 and one [2] = 0xa422bbce and one [3] = 0xdf885395 and one [4] = 0x04b547f5)
|
||||
assert ("test tdiv qr 1 2", two [0] = 0x0 and two [1] = 0x0 and two [2] = 0x0 and two [3] = 0x0 and two [4] = 0x0)
|
||||
end
|
||||
|
||||
test_divrem_1_div_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
rem: NATURAL_32
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 4)
|
||||
rem := divrem_1 (item, 0, one, 0, 4, 1)
|
||||
assert ("Test divrem 1 div 1", item.same_items (one, 0, 0, 4) and rem = 0)
|
||||
end
|
||||
|
||||
test_divrem_1_div_0
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
rem: NATURAL_32
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 4)
|
||||
create item.make_filled (0, 4)
|
||||
rem := divrem_1 (item, 0, one, 0, 4, 0x12345678)
|
||||
assert ("Test divrem 1 div 0", item.same_items (one, 0, 0, 4) and rem = 0x0)
|
||||
end
|
||||
|
||||
test_divrem_1_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
rem: NATURAL_32
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 4)
|
||||
one [3] := 0x80000000
|
||||
create item.make_filled (0, 4)
|
||||
rem := divrem_1 (item, 0, one, 0, 4, 4)
|
||||
assert ("Test divrem 1", item [3] = 0x20000000 and item [2] = 0x00000000 and item [1] = 0x00000000 and item [0] = 0x00000000 and rem = 0)
|
||||
end
|
||||
|
||||
test_divrem_1_2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
rem: NATURAL_32
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x80000000, 4)
|
||||
create item.make_filled (0, 4)
|
||||
rem := divrem_1 (item, 0, one, 0, 4, 4)
|
||||
assert ("Test divrem 1 2", item [3] = 0x20000000 and item [2] = 0x20000000 and item [1] = 0x20000000 and item [0] = 0x20000000 and rem = 0)
|
||||
end
|
||||
|
||||
test_divrem_1_3
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
rem: NATURAL_32
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 4)
|
||||
rem := divrem_1 (item, 0, one, 0, 4, 0x12345678)
|
||||
assert ("Test divrem 1 3", item [0] = 0x040021bc and item [1] = 0x880003f8 and item [2] = 0x10000077 and item [3] = 0x0000000e and rem = 0x026b07df)
|
||||
end
|
||||
|
||||
test_divrem_1_4
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
rem: NATURAL_32
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 4)
|
||||
rem := divrem_1 (item, 0, one, 0, 4, 0x87654321)
|
||||
assert ("Test divrem 1 4", item [0] = 0x8bcb369f and item [1] = 0x04899bbd and item [2] = 0xe4089ae4 and item [3] = 0x00000001 and rem = 0x65c75880)
|
||||
end
|
||||
|
||||
test_divrem_2_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
divisor: SPECIAL [NATURAL_32]
|
||||
junk: NATURAL_32
|
||||
item: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 4)
|
||||
create divisor.make_filled (0x80000000, 2)
|
||||
junk := divrem_2 (item, 0, one, 0, 4, divisor, 0)
|
||||
assert ("Test divrem 2 1", item [0] = 00000001 and item [1] = 0xfffffffe and item [2] = 0x00000000 and item [3] = 0x00000000 and junk = 0x00000001)
|
||||
assert ("Test divrem 2 1", one [0] = 0x7fffffff and one [1] = 0x7fffffff and one [2] = 0xffffffff and one [3] = 0xffffffff)
|
||||
end
|
||||
|
||||
test_divrem_2_2
|
||||
local
|
||||
numerator: SPECIAL [NATURAL_32]
|
||||
denominator: SPECIAL [NATURAL_32]
|
||||
junk: NATURAL_32
|
||||
quotient: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create numerator.make_filled (0xffffffff, 5)
|
||||
numerator [0] := 0xfffffffe
|
||||
numerator [4] := 0x00000001
|
||||
create denominator.make_filled (0xeeeeeeee, 2)
|
||||
create quotient.make_filled (0x0, 5)
|
||||
junk := divrem_2 (quotient, 0, numerator, 0, 5, denominator, 0)
|
||||
assert ("test divrem 2 2", quotient [0] = 0x92492494 and quotient [1] = 0x24924924 and quotient [2] = 0x00000002 and quotient [3] = 0x0 and quotient [4] = 0x0)
|
||||
assert ("test divrem 2 2", numerator [0] = 0x66666666 and numerator [1] = 0x66666666)
|
||||
end
|
||||
|
||||
test_limb_inverse_1
|
||||
local
|
||||
one: NATURAL_32
|
||||
res: NATURAL_32
|
||||
do
|
||||
one := 0x80000000
|
||||
res := limb_inverse (one)
|
||||
assert ("test limb inverse 1", res = 0xffffffff)
|
||||
end
|
||||
|
||||
test_limb_inverse_2
|
||||
local
|
||||
one: NATURAL_32
|
||||
res: NATURAL_32
|
||||
do
|
||||
one := 0xffffffff
|
||||
res := limb_inverse (one)
|
||||
assert ("test limb inverse 2", res = 0x00000001)
|
||||
end
|
||||
|
||||
test_limb_inverse_3
|
||||
local
|
||||
one: NATURAL_32
|
||||
res: NATURAL_32
|
||||
do
|
||||
one := 0x91a2b3c0
|
||||
res := limb_inverse (one)
|
||||
assert ("test limb inverse 3", res = 0xc200000e)
|
||||
end
|
||||
|
||||
test_mod_1_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
val: CELL [NATURAL_32]
|
||||
do
|
||||
create val.put (0)
|
||||
create one.make_filled (0, 5)
|
||||
one [0] := 0x02f36db3
|
||||
one [1] := 0x00000009
|
||||
one [2] := 0xffffffff
|
||||
one [3] := 0xffffffff
|
||||
one [4] := 0xffffffff
|
||||
mod_1 (one, 0, 2, 0x7b73add3, val)
|
||||
assert ("test mod 1 1", val.item = 0x54d134dd)
|
||||
end
|
||||
|
||||
test_preinv_divrem_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
junk: NATURAL_32
|
||||
do
|
||||
create one.make_filled (0, 5)
|
||||
one [1] := 0x87654321
|
||||
one [2] := 0xcccccccc
|
||||
one [3] := 0x33333333
|
||||
one [4] := 0xffffffff
|
||||
junk := preinv_divrem_1 (one, 0, 1, one, 1, 4, 0x3b9aca00, 0x12e0be82, 2)
|
||||
assert ("test preinv divrem 1", one [0] = 0xfe8ef428 and one [1] = 0x273df9b7 and one [2] = 0x46093181 and one [3] = 0x4b82fa06 and one [4] = 0x00000004 and junk = 0x1B487000)
|
||||
end
|
||||
|
||||
test_preinv_divrem_2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
junk: NATURAL_32
|
||||
do
|
||||
create one.make_filled (0, 5)
|
||||
one [0] := 0xfe8ef428
|
||||
one [1] := 0x273df9b7
|
||||
one [2] := 0x46093181
|
||||
one [3] := 0x4b82fa06
|
||||
one [4] := 0x00000004
|
||||
junk := preinv_divrem_1 (one, 0, 1, one, 1, 4, 0x3b9aca00, 0x12e0be82, 2)
|
||||
assert ("test preinv divrem 2", one [0] = 0x07fba954 and one [1] = 0x81c6f917 and one [2] = 0x725dd1c3 and one [3] = 0x00000012 and one [4] = 0x00000000 and junk = 0x33DBB800)
|
||||
end
|
||||
|
||||
test_preinv_divrem_3
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
junk: NATURAL_32
|
||||
do
|
||||
create one.make_filled (0, 9)
|
||||
one [1] := 0x99811941
|
||||
one [2] := 0x841fd605
|
||||
one [3] := 0xd960a1bf
|
||||
one [4] := 0x5e433efc
|
||||
one [5] := 0x48c9bc93
|
||||
one [6] := 0x1c8b6fb1
|
||||
one [7] := 0x8ca06de0
|
||||
one [8] := 0xc6182337
|
||||
junk := preinv_divrem_1 (one, 0, 1, one, 1, 8, 0xcfd41b91, 0x3b563c24, 0)
|
||||
assert ("test preinv divrem 2", one [0] = 0xb670b6b5 and one [1] = 0xf02cf008 and one [2] = 0x2a9327ab and one [3] = 0x2c16b429 and one [4] = 0x52cd5013 and one [5] = 0x2f45a033 and one [6] = 0x0fc1ade8 and one [7] = 0xf4026dfb and one [8] = 0x00000000 and junk = 0x1DFF6C7B)
|
||||
end
|
||||
|
||||
test_sb_divrem_mn_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
junk: NATURAL_32
|
||||
do
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create two.make_filled (0x80000000, 3)
|
||||
create item.make_filled (0, 1)
|
||||
junk := sb_divrem_mn (item, 0, one, 0, 4, two, 0, 3)
|
||||
assert ("test sb divrem mn 1", item [0] = 0xfffffffe and one [1] = 0x00000000 and one [2] = 0x00000000 and one [3] = 0x7fffffff and junk = 0x1)
|
||||
end
|
||||
|
||||
test_sb_divrem_mn_2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
res: NATURAL_32
|
||||
do
|
||||
create one.make_filled (0, 5)
|
||||
create two.make_filled (0, 9)
|
||||
create three.make_filled (0, 4)
|
||||
two [4] := 0x348
|
||||
three [0] := 0xc50fb804
|
||||
three [1] := 0x4da1b404
|
||||
three [2] := 0xf47a2e7d
|
||||
three [3] := 0x81d4eb6b
|
||||
|
||||
res := sb_divrem_mn (one, 0, two, 0, 8, three, 0, 4)
|
||||
assert ("test sb divrem mn 2", one [0] = 0x678 and one [1] = 0x0 and one [2] = 0x0 and one [3] = 0x0 and res = 0x0)
|
||||
end
|
||||
|
||||
test_sb_divrem_mn_3
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
val: NATURAL_32
|
||||
do
|
||||
create one.make_filled (0, 6)
|
||||
create two.make_filled (0, 10)
|
||||
create three.make_filled (0, 5)
|
||||
two [0] := 0x3dd05d50
|
||||
two [1] := 0x21d73803
|
||||
two [2] := 0xac812ddf
|
||||
two [3] := 0x282ac26e
|
||||
two [4] := 0xa6b39a66
|
||||
two [5] := 0xc0dff46b
|
||||
two [6] := 0xfd10f6a5
|
||||
two [7] := 0x54f656cd
|
||||
two [8] := 0xad5a122a
|
||||
two [9] := 0x029f5c84
|
||||
three [0] := 0xeb17ecc8
|
||||
three [1] := 0x108d44dd
|
||||
three [2] := 0x67732448
|
||||
three [3] := 0xc5a251f5
|
||||
three [4] := 0x8e98a154
|
||||
val := sb_divrem_mn (one, 0, two, 0, 10, three, 0, 5)
|
||||
assert ("test sb divrem mn 3 1", one [0] = 0x9019af3a and one [1] = 0x998d2570 and one [2] = 0xa422bbce and one [3] = 0xdf885395 and one [4] = 0x04b547f5)
|
||||
assert ("test sb divrem mn 3 2", two [0] = 0x0 and two [1] = 0x0 and two [2] = 0x0 and two [3] = 0x0 and two [4] = 0x0 and val = 0)
|
||||
end
|
||||
end
|
||||
446
contrib/ise_library/math/eapml/tests/test_special_gcd.e
Normal file
446
contrib/ise_library/math/eapml/tests/test_special_gcd.e
Normal file
@@ -0,0 +1,446 @@
|
||||
note
|
||||
description: "Summary description for {TEST_NUMBER_GCD}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_SPECIAL_GCD
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
SPECIAL_GCD
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_basic_gcd_1
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
res: INTEGER_32
|
||||
do
|
||||
create one_two.make_filled (0, 5)
|
||||
create three.make_filled (0, 5)
|
||||
one_two [0] := 0x7fffffff
|
||||
one_two [1] := 0xffffffff
|
||||
one_two [2] := 0xffffffff
|
||||
one_two [3] := 0xffffffff
|
||||
one_two [4] := 0xffffffff
|
||||
three [0] := 0xbd62fd99
|
||||
three [1] := 0x0211a89b
|
||||
three [2] := 0xacee6489
|
||||
three [3] := 0x98b44a3e
|
||||
three [4] := 0x11d3142a
|
||||
res := basic_gcd (one_two, 0, one_two, 0, 5, three, 0, 5)
|
||||
assert ("test basic gcd_1", one_two [0] = 0x00000001 and one_two [1] = 0x00000000 and one_two [2] = 0xffffffff and one_two [3] = 0xffffffff and one_two [4] = 0xffffffff and res = 1)
|
||||
end
|
||||
|
||||
test_basic_gcd_2
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
one_two [0] := 0xbead208b
|
||||
one_two [1] := 0x5e668076
|
||||
one_two [2] := 0x2abf62e3
|
||||
one_two [3] := 0x0000db7c
|
||||
three [0] := 0x6141c975
|
||||
three [1] := 0x22ddfba5
|
||||
three [2] := 0xa09fab66
|
||||
three [3] := 0x000075bd
|
||||
val := basic_gcd (one_two, 0, one_two, 0, 4, three, 0, 4)
|
||||
assert ("test basic gcd 2", one_two [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_basic_gcd_3
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
one_two [0] := 0xbead208b
|
||||
one_two [1] := 0x5e668076
|
||||
one_two [2] := 0x2abf62e3
|
||||
one_two [3] := 0x0000db7c
|
||||
three [0] := 0x0be1f345
|
||||
three [1] := 0x0943df37
|
||||
three [2] := 0x0565ad11
|
||||
three [3] := 0x00001f3e
|
||||
val := basic_gcd (one_two, 0, one_two, 0, 4, three, 0, 4)
|
||||
assert ("test basic gcd 3", one_two [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_basic_gcd_4
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
one_two [0] := 0xbead208b
|
||||
one_two [1] := 0x5e668076
|
||||
one_two [2] := 0x2abf62e3
|
||||
one_two [3] := 0x0000db7c
|
||||
three [0] := 0x8bb4ea3d
|
||||
three [1] := 0x1f8bcda9
|
||||
three [2] := 0x25f7d40e
|
||||
three [3] := 0x00002e40
|
||||
val := basic_gcd (one_two, 0, one_two, 0, 4, three, 0, 4)
|
||||
assert ("test basic gcd 4", one_two [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_basic_gcd_5
|
||||
local
|
||||
one_three: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_three.make_filled (0, 17)
|
||||
create two.make_filled (0, 17)
|
||||
two [0] := 0xd96a4395
|
||||
two [1] := 0xd77d6bb5
|
||||
two [2] := 0xff132ed5
|
||||
two [3] := 0xeca1c0e4
|
||||
two [4] := 0xb6df6c57
|
||||
two [5] := 0xfeb6912f
|
||||
two [6] := 0xafb643b9
|
||||
two [7] := 0xc05dd8ec
|
||||
two [8] := 0x12c61699
|
||||
two [9] := 0xd44be35a
|
||||
two [10] := 0xb675f7ea
|
||||
two [11] := 0x2ffd5545
|
||||
two [12] := 0xab960e36
|
||||
two [13] := 0xfd9a1223
|
||||
two [14] := 0xc5d32145
|
||||
two [15] := 0xb369d437
|
||||
two [16] := 0x000001ff
|
||||
one_three [0] := 0xffffffff
|
||||
one_three [1] := 0xffffffff
|
||||
one_three [2] := 0xffffffff
|
||||
one_three [3] := 0xffffffff
|
||||
one_three [4] := 0xffffffff
|
||||
one_three [5] := 0xffffffff
|
||||
one_three [6] := 0xffffffff
|
||||
one_three [7] := 0xffffffff
|
||||
one_three [8] := 0xffffffff
|
||||
one_three [9] := 0xffffffff
|
||||
one_three [10] := 0xffffffff
|
||||
one_three [11] := 0xffffffff
|
||||
one_three [12] := 0xffffffff
|
||||
one_three [13] := 0xffffffff
|
||||
one_three [14] := 0xffffffff
|
||||
one_three [15] := 0xffffffff
|
||||
one_three [16] := 0x000001ff
|
||||
val := basic_gcd (one_three, 0, two, 0, 17, one_three, 0, 17)
|
||||
assert ("test basic gcd 5", one_three [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_div2_1
|
||||
local
|
||||
r0: CELL [NATURAL_32]
|
||||
r1: CELL [NATURAL_32]
|
||||
val: NATURAL_32
|
||||
do
|
||||
create r0.put (0)
|
||||
create r1.put (0)
|
||||
val := div2 (r0, r1, 0x55bf739f, 0xc3945435, 0x0fff167f, 0xf3e8e754)
|
||||
assert ("test div2 1", r0.item = 0x0007cf91 and r1.item = 0x05c40320 and val = 0x5)
|
||||
end
|
||||
|
||||
test_div2_2
|
||||
local
|
||||
r0: CELL [NATURAL_32]
|
||||
r1: CELL [NATURAL_32]
|
||||
val: NATURAL_32
|
||||
do
|
||||
create r0.put (0)
|
||||
create r1.put (0)
|
||||
val := div2 (r0, r1, 0x9d001ff4, 0x08c14be0, 0x1f3e0565, 0xad110943)
|
||||
assert ("test div2 2", r0.item = 0xa76c1d91 and r1.item = 0x00ca04f7 and val = 0x5)
|
||||
end
|
||||
|
||||
test_find_a
|
||||
local
|
||||
val: NATURAL_32
|
||||
do
|
||||
val := find_a (0x68b82f95, 0xc45247ed)
|
||||
assert ("test find a", val = 0x52aa2b12)
|
||||
end
|
||||
|
||||
test_nhgcd2_1
|
||||
local
|
||||
five: SPECIAL [NATURAL_32]
|
||||
val: BOOLEAN
|
||||
do
|
||||
create five.make_filled (0, 4)
|
||||
val := nhgcd2 (0xdb7c2abf, 0x62e35e66, 0x75bda09f, 0xab6622dd, five)
|
||||
assert ("test nhgcd2 1", val and five [0] = 0x02c85433 and five [1] = 0x0c43d237 and five [2] = 0x017e1f50 and five [3] = 0x0694540b)
|
||||
end
|
||||
|
||||
test_nhgcd2_2
|
||||
local
|
||||
five: SPECIAL [NATURAL_32]
|
||||
val: BOOLEAN
|
||||
do
|
||||
create five.make_filled (0, 4)
|
||||
val := nhgcd2 (0xdb7c2abf, 0x62e35e66, 0x1f3e0565, 0xad110943, five)
|
||||
assert ("test nhgcd2 2", val and five [0] = 0x15d545dd and five [1] = 0x088e653f and five [2] = 0x031b98c4 and five [3] = 0x0137c9e1)
|
||||
end
|
||||
|
||||
test_nhgcd2_3
|
||||
local
|
||||
five: SPECIAL [NATURAL_32]
|
||||
val: BOOLEAN
|
||||
do
|
||||
create five.make_filled (0, 4)
|
||||
val := nhgcd2 (0xdb7c2abf, 0x62e35e66, 0x2e4025f7, 0xd40e1f8b, five)
|
||||
assert ("test nhgcd2 3", val and five [0] = 0x3d89bb6b and five [1] = 0x2b76efa2 and five [2] = 0x0cf7ad20 and five [3] = 0x0928b403)
|
||||
end
|
||||
|
||||
test_nhgcd2_4
|
||||
local
|
||||
five: SPECIAL [NATURAL_32]
|
||||
val: BOOLEAN
|
||||
do
|
||||
create five.make_filled (0, 4)
|
||||
val := nhgcd2 (0xdb7c2abf, 0x62e35e66, 0x0905a1c3, 0xf4cec73b, five)
|
||||
assert ("test nhgcd2 4", val and five [0] = 0x411e611d and five [1] = 0x05ebcf53 and five [2] = 0x02ad3db7 and five [3] = 0x003e4ece)
|
||||
end
|
||||
|
||||
test_ngcd_lehmer_1
|
||||
local
|
||||
one_three: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
four: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_three.make_filled (0, 7)
|
||||
one_three [0] := 0x05fadced
|
||||
one_three [1] := 0x01251177
|
||||
one_three [2] := 0x17eb73b4
|
||||
one_three [3] := 0x049445dc
|
||||
create two.make_filled (0, 5)
|
||||
two [0] := 0x236dc147
|
||||
two [1] := 0x0071f142
|
||||
two [2] := 0xffffffff
|
||||
two [3] := 0xffffffff
|
||||
two [4] := 0xffffffff
|
||||
create four.make_filled (0, 6)
|
||||
four [0] := 0x236dc147
|
||||
four [1] := 0x0071f142
|
||||
four [2] := 0x530b1a98
|
||||
four [3] := 0xbe9c1686
|
||||
four [4] := 0x9ecb20bd
|
||||
four [5] := 0x000000df
|
||||
val := ngcd_lehmer (one_three, 0, two, 0, one_three, 0, 2, four, 0)
|
||||
assert ("test ngcd lehmer 1", one_three [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_ngcd_lehmer_2
|
||||
local
|
||||
one_three: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
four: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_three.make_filled (0, 4)
|
||||
create two.make_filled (0, 4)
|
||||
create four.make_filled (0, 8)
|
||||
one_three [0] := 0x6141c975
|
||||
one_three [1] := 0x22ddfba5
|
||||
one_three [2] := 0xa09fab66
|
||||
one_three [3] := 0x000075bd
|
||||
two [0] := 0xbead208b
|
||||
two [1] := 0x5e668076
|
||||
two [2] := 0x2abf62e3
|
||||
two [3] := 0x0000db7c
|
||||
val := ngcd_lehmer (one_three, 0, two, 0, one_three, 0, 4, four, 0)
|
||||
assert ("test ngcd lehmer 2", one_three [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_ngcd_lehmer_3
|
||||
local
|
||||
one_three: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
four: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create two.make_filled (0, 4)
|
||||
create one_three.make_filled (0, 4)
|
||||
create four.make_filled (0, 8)
|
||||
two [0] := 0xbead208b
|
||||
two [1] := 0x5e668076
|
||||
two [2] := 0x2abf62e3
|
||||
two [3] := 0x0000db7c
|
||||
one_three [0] := 0x0be1f345
|
||||
one_three [1] := 0x0943df37
|
||||
one_three [2] := 0x0565ad11
|
||||
one_three [3] := 0x00001f3e
|
||||
val := ngcd_lehmer (one_three, 0, two, 0, one_three, 0, 4, four, 0)
|
||||
assert ("test ngcd lehmer 3", one_three [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_ngcd_lehmer_4
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
four: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
create four.make_filled (0, 8)
|
||||
one_two [0] := 0xbead208b
|
||||
one_two [1] := 0x5e668076
|
||||
one_two [2] := 0x2abf62e3
|
||||
one_two [3] := 0x0000db7c
|
||||
three [0] := 0x8bb4ea3d
|
||||
three [1] := 0x1f8bcda9
|
||||
three [2] := 0x25f7d40e
|
||||
three [3] := 0x00002e40
|
||||
val := ngcd_lehmer (one_two, 0, one_two, 0, three, 0, 4, four, 0)
|
||||
assert ("test ngcd lehmer 4", one_two [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_gcd_2_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_filled (0, 2)
|
||||
create two.make_filled (0, 2)
|
||||
one [0] := 0x236dc147
|
||||
one [1] := 0x0071f142
|
||||
two [0] := 0x05fadced
|
||||
two [1] := 0x01251177
|
||||
val := gcd_2 (one, 0, two, 0)
|
||||
assert ("test gcd 2", val = 1 and one [0] = 0x1 and one [1] = 0x0)
|
||||
end
|
||||
|
||||
test_gcd_1_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
val: NATURAL_32
|
||||
do
|
||||
create one.make_filled (0, 2)
|
||||
one [0] := 0x302ccd43
|
||||
one [1] := 0x0
|
||||
val := gcd_1 (one, 0, 1, 0xccd079fe)
|
||||
assert ("test gcd 1 1", val = 0x1)
|
||||
end
|
||||
|
||||
test_gcd_1
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
one_two [0] := 0xbead208b
|
||||
one_two [1] := 0x5e668076
|
||||
one_two [2] := 0x2abf62e3
|
||||
one_two [3] := 0x0000db7c
|
||||
three [0] := 0x6141c975
|
||||
three [1] := 0x22ddfba5
|
||||
three [2] := 0xa09fab66
|
||||
three [3] := 0x000075bd
|
||||
val := gcd (one_two, 0, one_two, 0, 4, three, 0, 4)
|
||||
assert ("test gcd 1", one_two [0] = 0x1 and one_two [1] = 0x0 and one_two [2] = 0x0 and one_two [3] = 0x0 and val = 1)
|
||||
end
|
||||
|
||||
test_gcd_2
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
one_two [0] := 0xbead208b
|
||||
one_two [1] := 0x5e668076
|
||||
one_two [2] := 0x2abf62e3
|
||||
one_two [3] := 0x0000db7c
|
||||
three [0] := 0x0be1f345
|
||||
three [1] := 0x0943df37
|
||||
three [2] := 0x0565ad11
|
||||
three [3] := 0x00001f3e
|
||||
val := gcd (one_two, 0, one_two, 0, 4, three, 0, 4)
|
||||
assert ("test gcd 2", one_two [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_gcd_3
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
one_two [0] := 0xbead208b
|
||||
one_two [1] := 0x5e668076
|
||||
one_two [2] := 0x2abf62e3
|
||||
one_two [3] := 0x0000db7c
|
||||
three [0] := 0x8bb4ea3d
|
||||
three [1] := 0x1f8bcda9
|
||||
three [2] := 0x25f7d40e
|
||||
three [3] := 0x00002e40
|
||||
val := gcd (one_two, 0, one_two, 0, 4, three, 0, 4)
|
||||
assert ("test gcd 3", one_two [0] = 0x1 and val = 1)
|
||||
end
|
||||
|
||||
test_gcd_4
|
||||
local
|
||||
one_three: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one_three.make_filled (0, 17)
|
||||
create two.make_filled (0, 17)
|
||||
two [0] := 0xd96a4395
|
||||
two [1] := 0xd77d6bb5
|
||||
two [2] := 0xff132ed5
|
||||
two [3] := 0xeca1c0e4
|
||||
two [4] := 0xb6df6c57
|
||||
two [5] := 0xfeb6912f
|
||||
two [6] := 0xafb643b9
|
||||
two [7] := 0xc05dd8ec
|
||||
two [8] := 0x12c61699
|
||||
two [9] := 0xd44be35a
|
||||
two [10] := 0xb675f7ea
|
||||
two [11] := 0x2ffd5545
|
||||
two [12] := 0xab960e36
|
||||
two [13] := 0xfd9a1223
|
||||
two [14] := 0xc5d32145
|
||||
two [15] := 0xb369d437
|
||||
two [16] := 0x000001ff
|
||||
one_three [0] := 0xffffffff
|
||||
one_three [1] := 0xffffffff
|
||||
one_three [2] := 0xffffffff
|
||||
one_three [3] := 0xffffffff
|
||||
one_three [4] := 0xffffffff
|
||||
one_three [5] := 0xffffffff
|
||||
one_three [6] := 0xffffffff
|
||||
one_three [7] := 0xffffffff
|
||||
one_three [8] := 0xffffffff
|
||||
one_three [9] := 0xffffffff
|
||||
one_three [10] := 0xffffffff
|
||||
one_three [11] := 0xffffffff
|
||||
one_three [12] := 0xffffffff
|
||||
one_three [13] := 0xffffffff
|
||||
one_three [14] := 0xffffffff
|
||||
one_three [15] := 0xffffffff
|
||||
one_three [16] := 0x000001ff
|
||||
val := gcd (one_three, 0, two, 0, 17, one_three, 0, 17)
|
||||
assert ("test gcd 4", one_three [0] = 0x1 and val = 1)
|
||||
end
|
||||
end
|
||||
252
contrib/ise_library/math/eapml/tests/test_special_logic.e
Normal file
252
contrib/ise_library/math/eapml/tests/test_special_logic.e
Normal file
@@ -0,0 +1,252 @@
|
||||
note
|
||||
description: "Summary description for {TEST_NUMBER_LOGIC}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_SPECIAL_LOGIC
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
SPECIAL_LOGIC
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_lshift_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
item: SPECIAL [NATURAL_32]
|
||||
carry: CELL [NATURAL_32]
|
||||
do
|
||||
create carry.put (0)
|
||||
create one.make_filled (0xffffffff, 4)
|
||||
create item.make_filled (0, 4)
|
||||
lshift (item, 0, one, 0, 4, 8, carry)
|
||||
assert ("Test lshift 1", item [0] = 0xffffff00 and item [1] = 0xffffffff and item [2] = 0xffffffff and item [3] = 0xffffffff and carry.item = 0xff)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_1
|
||||
-- Test if bit_xor_lshift copies lower limbs of op1 when entire limbs of 0 are shifted in to op2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 6)
|
||||
create two.make_filled (0x66666666, 6)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 6, three, 0, 4, 37)
|
||||
assert ("test bit xor lshift 1", one [0] = 0x66666666)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_2
|
||||
-- Test if bit_xor_lshift xors the lower partial part of op2 e.g. the first lower 27 bits in this case
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 6)
|
||||
create two.make_filled (0x66666666, 6)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 6, three, 0, 4, 37)
|
||||
assert ("test bit xor lshift 2", one [0] = 0x66666666 and one [1] = 0x33333326)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_3
|
||||
-- Test if bit_xor_lshift xors all limbs when there are enough from both op1 and op2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 6)
|
||||
create two.make_filled (0x66666666, 6)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 6, three, 0, 4, 37)
|
||||
assert ("test bit xor lshift 3", one [0] = 0x66666666 and one [1] = 0x33333326 and one [2] = 0x33333333 and one [3] = 0x33333333 and one [4] = 0x33333333)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_4
|
||||
-- Test if bit_xor_lshift xors the last part of the upper partial part of op2 e.g. the upper 5 bits in this case
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 6)
|
||||
create two.make_filled (0x66666666, 6)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 6, three, 0, 4, 37)
|
||||
assert ("test bit xor lshift 4", one [0] = 0x66666666 and one [1] = 0x33333326 and one [2] = 0x33333333 and one [3] = 0x33333333 and one [4] = 0x33333333 and one [5] = 0x66666673)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_5
|
||||
-- Test if bit_xor_lshift copies all extra limbs after op2 contents is exhausted
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 8)
|
||||
create two.make_filled (0x66666666, 7)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 7, three, 0, 4, 37)
|
||||
assert ("test bit xor lshift 5", one [0] = 0x66666666 and one [1] = 0x33333326 and one [2] = 0x33333333 and one [3] = 0x33333333 and one [4] = 0x33333333 and one [5] = 0x66666673 and one [6] = 0x66666666)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_6
|
||||
-- Test if bit_xor_lshift handles when op1 runs out of data before op2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 8)
|
||||
create two.make_filled (0x66666666, 4)
|
||||
create three.make_filled (0xaaaaaaaa, 6)
|
||||
bit_xor_lshift (one, 0, two, 0, 4, three, 0, 6, 37)
|
||||
assert ("test bit xor lshift 6", one [0] = 0x66666666 and one [1] = 0x33333326 and one [2] = 0x33333333 and one [3] = 0x33333333)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_7
|
||||
-- Test if bit_xor_lshift handles the shifted tail of op2 after op1 is consumed
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0x0, 8)
|
||||
create two.make_filled (0x66666666, 4)
|
||||
create three.make_filled (0xaaaaaaaa, 6)
|
||||
bit_xor_lshift (one, 0, two, 0, 4, three, 0, 6, 37)
|
||||
assert ("test bit xor lshift 7", one [0] = 0x66666666 and one [1] = 0x33333326 and one [2] = 0x33333333 and one [3] = 0x33333333 and one [4] = 0x55555555 and one [5] = 0x55555555 and one [6] = 0x55555555 and one [7] = 0x15)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_8
|
||||
-- Test when op1 and op2 are exhausted at the same time
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 8)
|
||||
create two.make_filled (0x66666666, 5)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 5, three, 0, 4, 37)
|
||||
assert ("test bit xor lshift 8", one [0] = 0x66666666 and one [1] = 0x33333326 and one [2] = 0x33333333 and one [3] = 0x33333333 and one [4] = 0x33333333 and one [5] = 0x15)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_9
|
||||
-- Test a normal xor
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 8)
|
||||
create two.make_filled (0x66666666, 4)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 4, three, 0, 4, 0)
|
||||
assert ("test bit xor lshift 9", one [0] = 0xcccccccc and one [1] = 0xcccccccc and one [2] = 0xcccccccc and one [3] = 0xcccccccc and one [4] = 0x0)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_10
|
||||
-- Test a tight fit xor
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 3)
|
||||
create two.make_filled (0x66666666, 3)
|
||||
create three.make_filled (0xaaaaaaaa, 2)
|
||||
bit_xor_lshift (one, 0, two, 0, 3, three, 0, 2, 22)
|
||||
assert ("test bit xor lshift 10", one [0] = 0xcce66666 and one [1] = 0xcccccccc and one [2] = 0x664ccccc)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_11
|
||||
-- Test a tight fit xor
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 4)
|
||||
create two.make_filled (0x66666666, 4)
|
||||
create three.make_filled (0xaaaaaaaa, 2)
|
||||
bit_xor_lshift (one, 0, two, 0, 4, three, 0, 2, 22)
|
||||
assert ("test bit xor lshift 11", one [0] = 0xcce66666 and one [1] = 0xcccccccc and one [2] = 0x664ccccc and one [3] = 0x66666666)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_12
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 8)
|
||||
create two.make_filled (0x66666666, 4)
|
||||
create three.make_filled (0xaaaaaaaa, 4)
|
||||
bit_xor_lshift (one, 0, two, 0, 4, three, 0, 4, 1)
|
||||
assert ("test bit xor lshift 12", one [0] = 0x33333332 and one [1] = 0x33333333 and one [2] = 0x33333333 and one [3] = 0x33333333 and one [4] = 0x1)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_13
|
||||
-- Test a normal xor
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 8)
|
||||
create two.make_filled (0x66666666, 4)
|
||||
create three.make_filled (0x0, 4)
|
||||
three [0] := 0x12345678
|
||||
three [1] := 0xfedcba98
|
||||
three [2] := 0x13579bdf
|
||||
three [3] := 0x2468ace0
|
||||
bit_xor_lshift (one, 0, two, 0, 4, three, 0, 4, 0)
|
||||
assert ("test bit xor lshift 13", one [0] = 0x7452301e and one [1] = 0x98badcfe and one [2] = 0x7531fdb9 and one [3] = 0x420eca86)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_14
|
||||
-- Test xor with op1 as a zero size operand
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 8)
|
||||
create two.make_filled (0x0, 0)
|
||||
create three.make_filled (0x0, 4)
|
||||
three [0] := 0x12345678
|
||||
three [1] := 0xfedcba98
|
||||
three [2] := 0x13579bdf
|
||||
three [3] := 0x2468ace0
|
||||
bit_xor_lshift (one, 0, two, 0, 0, three, 0, 4, 0)
|
||||
assert ("test bit xor lshift 14", one [0] = 0x12345678 and one [1] = 0xfedcba98 and one [2] = 0x13579bdf and one [3] = 0x2468ace0)
|
||||
end
|
||||
|
||||
test_bit_xor_lshift_15
|
||||
local
|
||||
one_two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one_two.make_filled (0, 5)
|
||||
create three.make_filled (0x0, 4)
|
||||
one_two [0] := 0x201
|
||||
one_two [1] := 0x0
|
||||
one_two [2] := 0x0
|
||||
one_two [3] := 0x20000
|
||||
three [0] := 0x3562c10f
|
||||
three [1] := 0xab1407d7
|
||||
three [2] := 0x616f35f4
|
||||
three [3] := 0x9d73
|
||||
bit_xor_lshift (one_two, 0, one_two, 0, 4, three, 0, 4, 2)
|
||||
assert ("test bit xor lshift 15", one_two [0] = 0xd58b063d and one_two [1] = 0xac501f5c and one_two [2] = 0x85bcd7d2 and one_two [3] = 0x75cd)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,146 @@
|
||||
note
|
||||
description: "Summary description for {TEST_NUMBER_NUMBER_THEORETIC}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
TEST_SPECIAL_NUMBER_THEORETIC
|
||||
|
||||
inherit
|
||||
EQA_TEST_SET
|
||||
SPECIAL_NUMBER_THEORETIC
|
||||
undefine
|
||||
default_create
|
||||
end
|
||||
|
||||
feature
|
||||
test_gcdext_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
cofactor: SPECIAL [NATURAL_32]
|
||||
target: SPECIAL [NATURAL_32]
|
||||
cofactor_count: TUPLE [cofactor_count: INTEGER]
|
||||
junk: INTEGER
|
||||
do
|
||||
create one.make_filled (0x80000000, 5)
|
||||
create two.make_filled (0x80000000, 5)
|
||||
one [4] := 0
|
||||
one [4] := 0
|
||||
create cofactor.make_filled (0, 4)
|
||||
create target.make_filled (0, 4)
|
||||
create cofactor_count
|
||||
junk := gcdext (target, 0, cofactor, 0, cofactor_count, one, 0, 4, two, 0, 4)
|
||||
assert ("test gcdext 1 gcd", target [0] = 0x80000000 and target [1] = 0x80000000 and target [2] = 0x80000000 and target [3] = 0x80000000)
|
||||
assert ("test gcdext 1 cofactor", cofactor [0] = 0x00000001 and cofactor [1] = 0x00000000 and cofactor [2] = 0x00000000 and cofactor [3] = 0x00000000 and cofactor_count.cofactor_count = 0)
|
||||
end
|
||||
|
||||
test_gcdext_2
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
cofactor: SPECIAL [NATURAL_32]
|
||||
target: SPECIAL [NATURAL_32]
|
||||
cofactor_count: TUPLE [cofactor_count: INTEGER]
|
||||
junk: INTEGER
|
||||
do
|
||||
create one.make_filled (0x80000000, 5)
|
||||
create two.make_filled (0x20000000, 5)
|
||||
one [4] := 0
|
||||
two [4] := 0
|
||||
create cofactor.make_filled (0, 4)
|
||||
create target.make_filled (0, 4)
|
||||
create cofactor_count
|
||||
junk := gcdext (target, 0, cofactor, 0, cofactor_count, one, 0, 4, two, 0, 4)
|
||||
assert ("test gcdext 2 gcd", target [0] = 0x20000000 and target [1] = 0x20000000 and target [2] = 0x20000000 and target [3] = 0x20000000)
|
||||
assert ("test gcdext 2 cofactor", cofactor [0] = 0x00000001 and cofactor [1] = 0x00000000 and cofactor [2] = 0x00000000 and cofactor [3] = 0x00000000 and cofactor_count.cofactor_count = 0)
|
||||
end
|
||||
|
||||
test_gcdext_3
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: TUPLE [three: INTEGER]
|
||||
four: SPECIAL [NATURAL_32]
|
||||
six: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_filled (0, 6)
|
||||
create two.make_filled (0, 6)
|
||||
create three
|
||||
create four.make_filled (0, 6)
|
||||
create six.make_filled (0, 6)
|
||||
four [0] := 0x7fffffff
|
||||
four [1] := 0xffffffff
|
||||
four [2] := 0xffffffff
|
||||
four [3] := 0xffffffff
|
||||
four [4] := 0xffffffff
|
||||
six [0] := 0xf58bf664
|
||||
six [1] := 0x0846a26e
|
||||
six [2] := 0xb3b99224
|
||||
six [3] := 0x62d128fa
|
||||
six [4] := 0x474c50aa
|
||||
val := gcdext (one, 0, two, 0, three, four, 0, 5, six, 0, 5)
|
||||
assert ("test gcdext 3 1", one [0] = 0x1 and one [1] = 0x0 and one [2] = 0x0 and one [3] = 0x0 and one [4] = 0x0 and one [5] = 0x0)
|
||||
assert ("test gcdext 3 2", two [0] = 0xe117d157 and two [1] = 0xfe887b52 and two [2] = 0x2a7b2b66 and two [3] = 0x56ad0915 and two [4] = 0x014fae42 and two [5] = 0x00000000)
|
||||
assert ("test gcdext 3 3", three.three = 5 and val = 1)
|
||||
end
|
||||
|
||||
test_basic_gcdext_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: TUPLE [three: INTEGER]
|
||||
four: SPECIAL [NATURAL_32]
|
||||
six: SPECIAL [NATURAL_32]
|
||||
val: INTEGER
|
||||
do
|
||||
create one.make_filled (0, 6)
|
||||
create two.make_filled (0, 6)
|
||||
create three
|
||||
create four.make_filled (0, 6)
|
||||
create six.make_filled (0, 6)
|
||||
four [0] := 0x7fffffff
|
||||
four [1] := 0xffffffff
|
||||
four [2] := 0xffffffff
|
||||
four [3] := 0xffffffff
|
||||
four [4] := 0xffffffff
|
||||
six [0] := 0xf58bf664
|
||||
six [1] := 0x0846a26e
|
||||
six [2] := 0xb3b99224
|
||||
six [3] := 0x62d128fa
|
||||
six [4] := 0x474c50aa
|
||||
val := basic_gcdext (one, 0, two, 0, three, four, 0, 5, six, 0, 5)
|
||||
assert ("test basic gcdext 1 1", one [0] = 0x1 and one [1] = 0x0 and one [2] = 0x0 and one [3] = 0x0 and one [4] = 0x0 and one [5] = 0x0)
|
||||
assert ("test basic gcdext 1 2", two [0] = 0xe117d157 and two [1] = 0xfe887b52 and two [2] = 0x2a7b2b66 and two [3] = 0x56ad0915 and two [4] = 0x014fae42 and two [5] = 0x00000000)
|
||||
assert ("test basic gcdext 1 3", three.three = 5 and val = 1)
|
||||
end
|
||||
|
||||
test_gcdext_div2_1
|
||||
local
|
||||
val: NATURAL_32
|
||||
do
|
||||
val := gcdext_div2 (0xe9021704, 0x8d4d6a9f, 0x80000000, 0x0)
|
||||
assert ("test gcdext div2 1", val = 0x1)
|
||||
end
|
||||
|
||||
test_invert_gf_1
|
||||
local
|
||||
one: SPECIAL [NATURAL_32]
|
||||
two: SPECIAL [NATURAL_32]
|
||||
three: SPECIAL [NATURAL_32]
|
||||
do
|
||||
create one.make_filled (0, 4)
|
||||
create two.make_filled (0, 4)
|
||||
create three.make_filled (0, 4)
|
||||
two [0] := 0x3562c10f
|
||||
two [1] := 0xab1407d7
|
||||
two [2] := 0x616f35f4
|
||||
two [3] := 0x9d73
|
||||
three [0] := 0x201
|
||||
three [3] := 0x20000
|
||||
invert_gf (one, 0, two, 0, 4, three, 0, 4)
|
||||
assert ("test invert gf 1", one [0] = 0x3e34792c and one [1] = 0xde538519 and one [2] = 0x9cd55090 and one [3] = 0xfa49)
|
||||
end
|
||||
end
|
||||
25
contrib/ise_library/math/eapml/tests/tests-safe.ecf
Normal file
25
contrib/ise_library/math/eapml/tests/tests-safe.ecf
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="tests" uuid="9FA1C743-D3D3-4ABA-BAB8-27986A422F01">
|
||||
<target name="tests">
|
||||
<root class="TEST" feature="make"/>
|
||||
<option trace="false" warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<variable name="eapml_limb_type" value="natural_32"/>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
|
||||
<library name="eapml" location="..\eapml-safe.ecf" readonly="false"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
|
||||
<cluster name="tests" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/.svn$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.hg$</exclude>
|
||||
</file_rule>
|
||||
<visible class="TEST" feature="make_2"/>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="tests_dotnet" extends="tests">
|
||||
<setting name="msil_generation" value="true"/>
|
||||
</target>
|
||||
</system>
|
||||
29
contrib/ise_library/math/eapml/tests/tests.ecf
Normal file
29
contrib/ise_library/math/eapml/tests/tests.ecf
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="tests" uuid="9FA1C743-D3D3-4ABA-BAB8-27986A422F01">
|
||||
<target name="tests" abstract="true">
|
||||
<root class="TEST" feature="make"/>
|
||||
<option trace="false" warning="true" full_class_checking="true" is_attached_by_default="false" void_safety="none" syntax="standard">
|
||||
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
|
||||
</option>
|
||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||
<library name="eapml" location="..\eapml.ecf" readonly="false"/>
|
||||
<library name="testing" location="$ISE_LIBRARY\library\testing\testing.ecf"/>
|
||||
<cluster name="tests" location=".\" recursive="true">
|
||||
<file_rule>
|
||||
<exclude>/.hg$</exclude>
|
||||
<exclude>/EIFGENs$</exclude>
|
||||
<exclude>/CVS$</exclude>
|
||||
<exclude>/.svn$</exclude>
|
||||
</file_rule>
|
||||
<visible class="TEST" feature="make_2"/>
|
||||
</cluster>
|
||||
</target>
|
||||
<target name="tests_gcc_32" extends="tests">
|
||||
<variable name="eapml_limb_type" value="natural_32"/>
|
||||
<variable name="eapml_scan_type" value="gcc"/>
|
||||
</target>
|
||||
<target name="tests_vc_32" extends="tests">
|
||||
<variable name="eapml_limb_type" value="natural_32"/>
|
||||
<variable name="eapml_scan_type" value="vc"/>
|
||||
</target>
|
||||
</system>
|
||||
1
contrib/ise_library/math/eapml/tests/tests.rc
Normal file
1
contrib/ise_library/math/eapml/tests/tests.rc
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user