Skip to content

Commit

Permalink
Update src/gmp/q.d, src/gmp/z.d: Put version(gmp_test) first on lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Per Nordlöw committed Oct 1, 2024
1 parent 19ca24b commit e064e4e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
32 changes: 16 additions & 16 deletions src/gmp/q.d
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ MpQ inverse()(auto ref const MpQ x) @trusted
alias inv = inverse;

/// construction and assignment
@safe @nogc version(gmp_test) unittest
version(gmp_test) @safe @nogc unittest
{
Q x = null;
assert(x.numerator == 0);
Expand Down Expand Up @@ -450,7 +450,7 @@ alias inv = inverse;
}

/// canonicalization
@safe @nogc version(gmp_test) unittest
version(gmp_test) @safe @nogc unittest
{
Q x = Q(2, 4);
assert(x.numerator == 2);
Expand All @@ -461,7 +461,7 @@ alias inv = inverse;
}

/// negative numerator canonicalization
@safe @nogc version(gmp_test) unittest
version(gmp_test) @safe @nogc unittest
{
Q x = Q(-2, 4);
assert(x.numerator == -2);
Expand All @@ -472,7 +472,7 @@ alias inv = inverse;
}

/// swap
@safe @nogc version(gmp_test) unittest
version(gmp_test) @safe @nogc unittest
{
Q x = Q(1, 2);
Q y = Q(1, 3);
Expand All @@ -482,7 +482,7 @@ alias inv = inverse;
}

/// invert
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
Q x = Q(1, 2);
assert(x.numerator == 1);
Expand All @@ -504,7 +504,7 @@ alias inv = inverse;
}

/// inversion
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
const Q q = Q(-2, 3);
assert(inverse(q) == Q(-3, 2));
Expand All @@ -515,15 +515,15 @@ alias inv = inverse;
}

/// absolute value
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
const Q q = Q(-2, 3);
assert(abs(q) == Q(2, 3));
assert(abs(Q(-2, 3)) == Q(2, 3));
}

/// integer and fractional part
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
Q x = Q(5, 2);

Expand All @@ -548,7 +548,7 @@ alias inv = inverse;
}

/// casting
@safe @nogc version(gmp_test) unittest
version(gmp_test) @safe @nogc unittest
{
assert(cast(double)Q(1, 2) == 0.5f);
assert(cast(double)Q(1, 2) == 0.5);
Expand All @@ -557,7 +557,7 @@ alias inv = inverse;
}

/// equality
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
assert(Q(1, 1) == 1);
assert(Q(2, 1) == 2);
Expand All @@ -568,15 +568,15 @@ alias inv = inverse;
}

/// sign
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
assert(Q(-1, 3).sgn == -1);
assert(Q( 0, 3).sgn == 0);
assert(Q( 1, 3).sgn == 1);
}

/// comparison
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
assert(Q( 1, 3) < Q(1, 2));
assert(Q( 1, 2) > Q(1, 3));
Expand All @@ -599,31 +599,31 @@ alias inv = inverse;
}

/// addition
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
assert(Q(1, 2) + Q(1, 2) == Q(1, 1));
assert(Q(1, 3) + Q(1, 3) == Q(2, 3));
assert(Q(1, 2) + Q(1, 3) == Q(5, 6));
}

/// subtraction
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
assert(Q(1, 2) - Q(1, 2) == Q( 0, 1));
assert(Q(1, 2) - Q(1, 3) == Q (1, 6));
assert(Q(1, 3) - Q(1, 2) == Q(-1, 6));
}

/// multiplication
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
assert(Q(1, 2) * Q(1, 2) == Q(1, 4));
assert(Q(2, 3) * Q(2, 3) == Q(4, 9));
assert(Q(1, 2) * Q(1, 3) == Q(1, 6));
}

/// division
@safe version(gmp_test) unittest
version(gmp_test) @safe unittest
{
assert(Q(2, 3) / Q(2, 3) == Q(1, 1));
assert(Q(2, 3) / Q(2, 3) == 1);
Expand Down
Loading

0 comments on commit e064e4e

Please sign in to comment.