51 Commits

Author SHA1 Message Date
Andreas Stenmark
14a27b4d2f Removed unneded semicolons. 2025-11-30 22:23:01 +01:00
Andreas Stenmark
ad11d3bea0 Fix #5978: choice_bit_set respects bit_set domain 2025-11-30 21:46:26 +01:00
Yawning Angel
aa8e6e0938 tests: Add random number generator tests 2025-11-29 16:16:52 +09:00
Jeroen van Rijn
eff32e18a7 Also test a big int with a large number of zeroes. 2025-11-27 16:32:27 +01:00
Jeroen van Rijn
1ea5990be2 Speed up big.itoa
Extract 18 (64-bit) or 8 (32-bit) digits per big division.
This gives a 2.5x speedup for a 1024-bit bigint.
2025-11-27 15:35:05 +01:00
gingerBill
0b4884ada4 Update test generator 2025-11-27 09:21:54 +00:00
Jeroen van Rijn
56aab55d82 Fix #5931
Fix #5931 and add test case for it.
2025-11-18 15:37:57 +01:00
gingerBill
842cfee0f3 Change Odin's LICENSE to zlib from BSD 3-clause
This change was made in order to allow things produced with Odin and using Odin's core library, to not require the LICENSE to also be distributed alongside the binary form.
2025-10-28 14:38:25 +00:00
Jeroen van Rijn
ee93f48729 core:math/bits: Finish docs, add bitfield_extract + bitfield_insert test. 2025-10-14 23:30:38 +02:00
Jeroen van Rijn
347eae3a66 core:math/bits: Add docs + tests for rotate_left* and log2 2025-10-14 23:30:38 +02:00
Jeroen van Rijn
0f90a610a2 Delete duplicate test vectors. 2025-06-11 00:49:51 +02:00
Jeroen van Rijn
9dafd77bc0 Turn core:math/bìg tests into regular core:testing tests.
`core:math/big` has been verified against Python's big integer implementation long enough.
Turn it into a regular regression test using the `core:testing` framework, testing against
a generated corpus of test vectors.
2025-06-11 00:40:52 +02:00
Jeroen van Rijn
4e50b9d331 Fix path 2025-06-10 16:55:03 +02:00
Jeroen van Rijn
4f4839ecc5 Add initial tests for big rationals 2025-06-10 16:46:12 +02:00
Feoramund
b7de15caa3 Clarify strconv.append_* to strconv.write_* 2025-06-05 16:56:00 -04:00
Jeroen van Rijn
678fa897f5 signbit -> sign_bit in tests/core/math 2025-04-15 16:20:49 +02:00
Barinzaya
bbaec119e5 Added tests for math.nextafter. 2025-04-07 16:27:41 -04:00
Feoramund
b49b80bdf9 Add test for count_digits_of_base 2024-08-18 20:14:14 -04:00
Jeroen van Rijn
c33bf7673f Fix core:math/fixed. 2024-06-26 20:12:55 +02:00
gingerBill
23351ca8be Merge pull request #3137 from laytan/show-defineable
Add flags to show/export defineable values and warn if a -define is unused in the project
2024-06-20 11:45:52 +01:00
Feoramund
aab5338134 Add tests for core:math/rand 2024-06-15 15:49:05 -04:00
Feoramund
fe5c278fca Add test for core:math/big permutation & combination procs 2024-06-09 20:42:09 -04:00
Feoramund
f0d65112b8 Rename math/big test package
This is in line with the other tests, and it does not seem to affect
building the library.
2024-06-09 20:42:07 -04:00
Laytan Laats
f2be35f1f0 remove caught unused define 2024-06-07 15:22:14 +02:00
Feoramund
890fe07c6e Disable FANCY_OUTPUT in Odin test scripts
This should tidy up the CI output logs a bit.
2024-06-02 14:54:32 -04:00
Jeroen van Rijn
b0faab29e0 Port tests\core\math, math\linalg\glsl and math\noise 2024-06-02 14:47:09 -04:00
Juan Ignacio Díaz
7a592cbb31 port math.round from Golang 2024-02-16 13:23:44 -03:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
Jeroen van Rijn
07cd6cd670 Change large math/big test literals to hex.
In September 2022, the Python team addressed a possible DoS issue converting big integers to and from base 10 strings: https://github.com/python/cpython/issues/95778

Converting to/from base 10 is a quadratic operation, so they limited it to 4300 digits: https://discuss.python.org/t/int-str-conversions-broken-in-latest-python-bugfix-releases/18889/83

Github CI still uses an old Python version which parsed our test suite just fine. This patch converts them to hex literals to ensure our test doesn't break when Github does update to a non-vulnerable Python version released after September 2022.
2023-09-30 11:16:36 +02:00
gingerBill
be6f355665 Keep -vet happy by removing using 2023-07-31 12:32:30 +01:00
gingerBill
5dba08fb3b Keep -vet happy 2023-07-31 12:19:25 +01:00
gingerBill
8aa36072fc Remove using where easily possible 2023-07-31 12:11:17 +01:00
gingerBill
0c25f7cdc5 Improve core:math procedures and add loads of unit tests 2022-11-29 11:39:44 +00:00
gingerBill
f7211408fc Merge pull request #1544 from FancyKillerPanda/build_ignore
Changed `//+ignore` to `//+build ignore` and emit a warning for unknown tags
2022-11-03 12:58:26 +00:00
Jeroen van Rijn
40f0f5ad8d Update CI for math library. 2022-04-26 15:01:09 +02:00
Jeroen van Rijn
63331ef731 Revert "Merge pull request #1702 from Kelimion/filename_generation"
This reverts commit a40a53b104, reversing
changes made to 5422a3b17e.
2022-04-24 19:53:36 +02:00
Jeroen van Rijn
3cab2592c3 Compiler: Add early error for output path being a directory.
- Introduce new `Path` type and an array of build paths on the build context.
- Resolve input and output paths/files early (before parsing).
- Error early if inputs are missing or outputs are directories.
- Plumb new file path generation into linker stage instead of its adhoc method.

TODO:
- Remove more adhoc file path generation in parser and linker stage.
- Make intermediate object file generation use new path system.
- Round out and robustify Path helper functions.
2022-04-24 13:37:26 +02:00
Jeroen van Rijn
581d53b96b [math/big] Tell Python test runner how many nails we use.
`_DIGIT_NAILS` is defined as 4, meaning that we use 60 out of every 64 bits.
We can use as few as 1 nail, using 63 bits out of every 64, and all tests will still pass.

However, it needs more testing to see if that's a worthwhile change to make.

For the tests to work properly when changing the nails, Python needs to know about it as well.

In addition, compile the big math code with `-o:speed` going forward.
2022-04-01 16:24:27 +02:00
gitlost
7dbcaf792d Merge branch 'master' into fract_trunc_classify_#1574
Resolve conflicts with [9848e88] & sameify Makefile & tests/common/common.odin
2022-03-09 16:09:04 +00:00
gitlost
b94a7a87fa Fix issue #1574 "fract in linalg/glm is broken" by fixing
trunc_f16/32/64 in "math.odin" (~ typos on expressions)
Fix classify_f16 Inf test (would fail for subnormal 0h0001)
  by changing multiplier 0.5 -> 0.25
Add some useful consts to "math.odin" (INF_F16 etc)
Add comment to "demo.odin" mentioning that -0.0 must be used
  to specify negative zero
2022-03-08 18:06:25 +00:00
Jeroen van Rijn
6d7217f37a [varint] Add LEB128 decoding + tests
Also make tests in general less spammy: Don't print [PASS] for each successful test, only report failures and progress.
2022-03-08 15:40:00 +01:00
Jeroen van Rijn
6d9f84ba03 [tests] Make test runners exit with errorlevel 1 if a test fails. 2022-03-03 15:16:16 +01:00
FancyKillerPanda
e139d1cbe4 Removed //+build ignore from tests/core/math/big/test.odin. 2022-02-24 12:45:03 +11:00
FancyKillerPanda
62ff8daa78 Changed //+ignore to //+build ignore. 2022-02-24 12:23:54 +11:00
NoahR02
accb35506f Ports OpenSimplex2 from https://github.com/KdotJPG/OpenSimplex2 to Odin. Adds tests for the noise procedures. 2022-02-08 06:25:07 -05:00
NoahR02
817bc7434d Ports OpenSimplex2 from https://github.com/KdotJPG/OpenSimplex2 to Odin. Adds tests for the noise procedures. 2022-02-08 06:16:10 -05:00
Jeroen van Rijn
938744b276 [math/big] Rename internal_int_shl_digit to _private_int_shl_leg.
Same for the SHR variant. These are pure implementation details to shift by a leg/word at a time.
Prevent accidental usage.
2021-12-11 15:22:24 +01:00
Jeroen van Rijn
c94098c2ab [math/big] Fix int_set and int_get. 2021-12-09 16:14:04 +01:00
Jeroen van Rijn
f978e74773 LLVM 12 big math test workaround. 2021-09-11 20:36:09 +02:00
Jeroen van Rijn
ce2f926ff7 Separate math/big test. 2021-09-07 20:24:02 +02:00