Commit Graph

604 Commits

Author SHA1 Message Date
Damian Tarnawski
ce0cf7076c Add missing test attr and don't zero memory when reserve already did 2025-08-26 13:03:26 +02:00
gingerBill
83a78d5d28 Merge branch 'master' into soa-resize-zero-memory 2025-08-26 11:26:15 +01:00
Damian Tarnawski
8a894c6ce6 More soa tests 2025-08-24 15:09:08 +02:00
Damian Tarnawski
2a6dfd2545 Avoid overlap issues when correcting memory after resize in _reserve_soa 2025-08-23 16:55:12 +02:00
Damian Tarnawski
18a2980d26 Zero existing memory when using resize_soa (fixes #5614) 2025-08-23 14:28:25 +02:00
Damian Tarnawski
05706864b7 Support using allocator resize in _reserve_soa (fixes #5615) 2025-08-23 12:55:07 +02:00
gingerBill
414b1059a8 Fix typo 2025-08-08 12:36:56 +01:00
gingerBill
d381d0ece4 Fix more procedure to be contextless 2025-08-08 12:33:34 +01:00
gingerBill
e049dde582 Fix tests for UTF-16 strings 2025-08-02 13:01:58 +01:00
gingerBill
5aec40e3e0 Remove unneeded uses of intrinsics.constant_utf16_cstring 2025-08-02 12:55:05 +01:00
Jeroen van Rijn
3a7e4873cd Fix #5498
Also:
- Expands `tests/core/hash`
- Fixes bug found in `#hash(s, "murmur64")`
2025-07-25 12:00:24 +02:00
Feoramund
58f32cd690 Fix Linux-specific optimized test failure
The stack was not aligned as expected for `buddy_allocator_init` when
`-o:speed` was enabled, making this a test failure that only appeared
with optimizations enabled.

The data is now aligned specifically, as it should be.
2025-07-22 10:40:16 -04:00
Jeroen van Rijn
e89abd006f Fix #5452 2025-07-11 15:29:27 +02:00
Jeroen van Rijn
ebdf2e17f3 Remove altogether. 2025-06-24 16:37:30 +02:00
Jeroen van Rijn
da3ab6a609 Disable two tests under core/sys/posix. 2025-06-24 14:04:18 +02:00
Brad Lewis
fc58158fb7 Fix issue parsing vendor/stb/image with the core:odin/parser parser 2025-06-22 09:42:33 -04:00
Jeroen van Rijn
1903d7211e Fix early join after start. 2025-06-21 11:47:00 +02:00
Laytan Laats
30e1c96269 uncomment test, see if it's fixed 2025-06-20 22:15:21 +02:00
Laytan
7f648d11d6 Merge pull request #5329 from JackMordaunt/jfm-fix_chan_try_send
chan: fix try_send and send
2025-06-20 22:11:39 +02:00
Jeroen van Rijn
69c0fe8305 Merge pull request #5344 from Feoramund/fix-2694
Review `core/mem/allocators.odin`
2025-06-19 18:35:17 +02:00
David Holland
0a45d4de0c Fix WAVEFORMATEX struct size (#5356)
* fix WAVEFORMATEX struct size
* fix size test for WAVEFORMATEX
* pack WAVEFORMATEXTENSIBLE
2025-06-18 12:25:09 +02:00
Feoramund
36762ce081 Add tests for new test failure expectation API 2025-06-16 11:25:32 -04:00
Jeroen van Rijn
1bd48df41f Disable test_try_select_raw_happy 2025-06-16 12:59:24 +02:00
Feoramund
0b2cf9a4ca Add a tiny sanity test for core:mem allocators 2025-06-15 14:29:30 -04:00
Jack Mordaunt
130b2dc36d tests/core/sync/chan: test concurrent send/close/recv
This test is designed to ensure that a call to send will always
correctly report whether the value was transmitted. If recv wins, a
close call should not be able to intercept the send thread.
2025-06-13 18:07:21 -03:00
Jack Mordaunt
760d8c1cdd core/sync/chan.send: return false if channel is closed while blocked
This commit makes send behave the same as recv: that the call will
return false if the channel is closed while a thread is waiting on the
blocking operation.

Prior logic would have send return true even if the channel was actually
closed rather than read from.

Docs adjusted to make this clear.
Tests added to lock in this behaviour.
2025-06-12 17:35:49 -03:00
Jack Mordaunt
2d12e265cc tests/core/sync/chan: add test for contended try_send
This test ensures that contending threads racing to try_send against a
single blocking read will result in exactly one winner without any
senders blocking.
2025-06-12 17:35:48 -03:00
Jack Mordaunt
c29168f76f core/sync/chan.try_send: avoid blocking if no reader is available
This changes the semantics of try_send to be consistently non-blocking.

That is, if the buffered is full OR there are no readers it returns
false.

The previous behaviour was such that it would block in the latter case
of no reader, and it would wait for a reader. That is problematic
because it produces inconsistent behaviour between buffered and
unbuffered channels which is astonishing and adds complexity to the
caller.

To illustrate the problem with the old behaviour, consider the
try_select operation: if a send-channel happens to be unbuffered the
try_select (which wants to never block) can now block, that unbuffered
send channel is selected (at random) and there is no reader on the other
side. Thus we have unpredictable blocking behaviour, which breaks the
guarantee that try_select never blocks.

If you want a blocking send you can just call "send" (the blocking
variant).

In addition, there is some reader/writer math done inside
can_{send,recv} such that they only report true if there is sufficient
reader/writer capacity. If there is contention we need to ensure that
each reader is paired to exactly one writer.

Consider try_send: if there is a single reader we can send. If there is
a single reader and a single writer, then we cannot send, as that reader
will be paired with the existing writer. Therefore can_send is only true
if there are more readers than writers at the time of check.

NOTE: The original tests don't need to use wait-looping with thread.yield()
or heuristic sleep. Instead we can just use blocking channel operations
rather than non-blocking operations.
2025-06-12 17:35:48 -03:00
Jack Mordaunt
52d38f1788 test/core/sync/chan: serialize try_select tests
These tests will race access to __global_context_for_test, which can
cause the test suite to flake. Even though only a single test actually
references the variable, the logic in try_select consumes it.
2025-06-12 17:15:37 -03:00
Jack Mordaunt
3c3fd6e580 tests/core/sync/chan: move global state into test
While this state is not actually needed by more than one test, we can
just make it a static variable.
2025-06-12 16:14:52 -03:00
Jack Mordaunt
4d7c182f7d tests/core/sync/chan: test harness for chan.try_select_raw
This test harness ensures consistent non-blocking semantics and
validates that we have solved the toctou condition.

The __global_context_for_test is a bit of a hack to fuse together the
test supplied proc and the executing logic in packaage chan.
2025-06-12 16:14:52 -03:00
Feoramund
66b2acbf24 container/queue: Add tests 2025-06-11 11:55:30 -04: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
6dee422700 flags: Rename varg to overflow, let it be renamed with config 2025-06-09 13:02:05 -04:00
Feoramund
cae43b801f Add more core:flags tests to codify behavior 2025-06-09 11:39:10 -04:00
Feoramund
e20db8df89 flags: Rename variadic to manifold (breaking change) 2025-06-09 11:27:27 -04:00
Feoramund
b7de15caa3 Clarify strconv.append_* to strconv.write_* 2025-06-05 16:56:00 -04:00
Laytan Laats
9eefa2006e encoding/cbor: support simd vectors 2025-06-04 22:00:02 +02:00
Laytan Laats
85224b21e6 encoding/cbor: support the matrix type 2025-06-04 21:51:12 +02:00
Jeroen van Rijn
890e923051 Vectorize strings.prefix_length.
Also add `strings.common_prefix`.
2025-05-31 20:24:21 +02:00
Feoramund
b15a665898 Add tests for runtime.memory_* comparison procedures 2025-05-29 16:34:07 -04:00
Feoramund
35b157ac83 Fix multiline RegEx iteration
In `.Multiline` mode:

- `^` is now defined to assert the start of the string or that a "\n" or
  "\r" rune was parsed on last VM dispatch.

- `$` is now defined to consume a newline sequence of "\n", "\r", or
  "\r\n" or to assert the end of the string.
2025-05-26 14:48:45 -04:00
Feoramund
5d01acc04f Add more RegEx tests 2025-05-24 07:42:04 -04:00
Feoramund
37d6491300 Remove Global RegEx flag, default to unanchored patterns 2025-05-24 07:42:04 -04:00
Feoramund
fedb9efb41 Make RegEx VM restartable and fix iterator infinite loop 2025-05-24 07:23:04 -04:00
Jeroen van Rijn
30388cada3 Fix os2.clean_path on Windows 2025-05-11 15:35:52 +02:00
Laytan Laats
ebc63a7355 add hexfloat (0h) parsing to strconv 2025-05-10 15:11:52 +02:00