std.math.egcd: Skip large integer tests for C backend

This commit is contained in:
Frank Denis 2025-10-20 23:08:51 +02:00
parent b8ddb047bf
commit 319db02137

View file

@ -1,4 +1,5 @@
const std = @import("std");
const builtin = @import("builtin");
/// Result of the Extended Euclidean Algorithm containing the GCD and Bézout coefficients.
/// For inputs a and b, returns gcd, x, y such that: a*x + b*y = gcd
@ -196,6 +197,7 @@ test "u64 very large values" {
}
test "u128 values" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO: C backend missing big integer helpers
const a: u128 = 123456789012345678901234567890;
const b: u128 = 987654321098765432109876543210;
const result = egcd(a, b);
@ -311,6 +313,7 @@ test "modular inverse use case" {
try std.testing.expectEqual(@as(u64, 1), verify);
}
test "u256 type" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO: C backend missing big integer helpers
const a: u256 = 123456789012345678901234567890123456789012345678901234567890;
const b: u256 = 987654321098765432109876543210987654321098765432109876543210;
const result = egcd(a, b);
@ -324,6 +327,7 @@ test "u256 type" {
}
test "u512 type" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO: C backend missing big integer helpers
const a: u512 = 999999999999999999;
const b: u512 = 888888888888888888;
const result = egcd(a, b);
@ -334,6 +338,7 @@ test "u512 type" {
}
test "i256 type" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO: C backend missing big integer helpers
const a: i256 = -123456789012345678901234567890;
const b: i256 = 987654321098765432109876543210;
const result = egcd(a, b);
@ -347,6 +352,7 @@ test "i256 type" {
}
test "u1024 type" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO: C backend missing big integer helpers
// Test that very large types compile and work
const a: u1024 = 12345678901234567890;
const b: u1024 = 9876543210987654321;
@ -358,6 +364,8 @@ test "u1024 type" {
}
test "u4096" {
if (true) return error.SkipZigTest; // Codegen error on some platforms
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO: C backend missing big integer helpers
const a: u4096 = 100;
const b: u4096 = 50;
const result = egcd(a, b);