Skip to content

Commit 8ae84c2

Browse files
chqrliebvdberg
authored andcommitted
Tests: fix modulo tests
* split test file so both `static_assert` and `assert` expressions may cause argument type errors to be reported.
1 parent b2c0efd commit 8ae84c2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
// @warnings{no-unused}
22
module test;
33

4-
static_assert( 10 % 20, 10);
5-
static_assert(-10 % 20, -10);
6-
static_assert( 10 % -20, 10);
7-
static_assert(-10 % -20, -10);
8-
static_assert(10.0 % 2, 0); // @error{invalid operand for binary operation remainder}
9-
10-
static_assert(10 % 2.0, 0); // @error{invalid operand for binary operation remainder}
11-
124
fn void test1() {
13-
const f32 a = 10 % 2.0;
5+
f32 a = 10 % 2.0; // @error{invalid operand for binary operation remainder}
146
}
157

168
fn void test2() {
17-
const f32 a = 10.0 % 5;
9+
f32 a = 10.0 % 5; // @error{invalid operand for binary operation remainder}
1810
}
19-
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @warnings{no-unused}
2+
module test;
3+
4+
static_assert( 10 % 20, 10);
5+
static_assert(-10 % 20, -10);
6+
static_assert( 10 % -20, 10);
7+
static_assert(-10 % -20, -10);
8+
static_assert(10.0 % 2, 0); // @error{invalid operand for binary operation remainder}
9+
static_assert(10 % 2.0, 0); // @error{invalid operand for binary operation remainder}

0 commit comments

Comments
 (0)