stage2: add @rem tests to llvm and c backends
This commit is contained in:
@@ -916,6 +916,23 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
, "");
|
||||
}
|
||||
|
||||
{
|
||||
var case = ctx.exeFromCompiledC("@rem", linux_x64);
|
||||
case.addCompareOutput(
|
||||
\\fn assert(ok: bool) void {
|
||||
\\ if (!ok) unreachable;
|
||||
\\}
|
||||
\\fn rem(lhs: i32, rhs: i32, expected: i32) bool {
|
||||
\\ return @rem(lhs, rhs) == expected;
|
||||
\\}
|
||||
\\pub export fn main() c_int {
|
||||
\\ assert(rem(-5, 3, -2));
|
||||
\\ assert(rem(5, 3, 2));
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
}
|
||||
|
||||
ctx.h("simple header", linux_x64,
|
||||
\\export fn start() void{}
|
||||
,
|
||||
|
||||
@@ -225,4 +225,21 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\}
|
||||
, "");
|
||||
}
|
||||
|
||||
{
|
||||
var case = ctx.exeUsingLlvmBackend("@rem", linux_x64);
|
||||
case.addCompareOutput(
|
||||
\\fn assert(ok: bool) void {
|
||||
\\ if (!ok) unreachable;
|
||||
\\}
|
||||
\\fn rem(lhs: i32, rhs: i32, expected: i32) bool {
|
||||
\\ return @rem(lhs, rhs) == expected;
|
||||
\\}
|
||||
\\pub export fn main() c_int {
|
||||
\\ assert(rem(-5, 3, -2));
|
||||
\\ assert(rem(5, 3, 2));
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user