mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Added @likely, @unlikely and @expect macros. (#727)
This commit is contained in:
23
test/unit/stdlib/macros/core_builtins.c3
Normal file
23
test/unit/stdlib/macros/core_builtins.c3
Normal file
@@ -0,0 +1,23 @@
|
||||
module core_builtin_tests;
|
||||
|
||||
fn void! test_likely() @test
|
||||
{
|
||||
assert(@likely(2 > 1));
|
||||
assert(@likely(2 > 1, 0.5));
|
||||
}
|
||||
|
||||
fn void! test_unlikely() @test
|
||||
{
|
||||
assert(@unlikely(2 < 1));
|
||||
assert(@unlikely(2 < 1, 0.5));
|
||||
}
|
||||
|
||||
fn void! test_expect() @test
|
||||
{
|
||||
assert(@expect(2 > 1, true));
|
||||
assert(@expect(2 < 1, false));
|
||||
|
||||
assert(@expect(2 > 1, true, 0.5));
|
||||
assert(@expect(2 < 1, false, 0.5));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user