This repository has been archived on 2025-02-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Pivot/test/test_rational.cpp
Persson-dev f5a282c455
All checks were successful
Linux arm64 / Build (push) Successful in 6m40s
allow tests in release mode
2024-05-04 12:42:26 +02:00

28 lines
712 B
C++

#include "NR.h"
#include "test_assert.h"
static void test() {
test_assert((NR {1, 5} == NR {5, 25}));
test_assert((NR {1, 5} != NR {4, 25}));
test_assert(NR {2} == NR {1} + 1);
test_assert(NR {1} == (NR {1, 4} + NR {3, 4}));
test_assert((NR {-3, -4} == NR {1, 2} + NR {1, 4}));
test_assert((NR {-1, 4} == NR {1, 4} - NR {1, 2}));
test_assert((NR {1, -4} == NR {1, 4} - NR {1, 2}));
test_assert((-NR {1, 4} == NR {1, 4} - NR {1, 2}));
test_assert((NR {2} == NR {4, 3} * NR {3, 2}));
test_assert((NR {3, 5} == NR {4, 5} * NR {3, 4}));
test_assert((NR {21, 16} == NR {7, 8} / NR {6, 9}));
test_assert((NR {4, 3} == NR {3, 4}.Inverse()));
}
int main(int argc, char** argv) {
test();
return 0;
}