Skip to content

Commit

Permalink
changed test to hopefully work crossplatform
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Yankowitz authored and Benjamin Yankowitz committed Feb 14, 2024
1 parent fab84a6 commit aa82bb0
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions tests/PolynomialTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,55 +16,56 @@

TEST_CASE("7th degree polynomial with rational roots", "[factor][duplicateRoot]")
{
// 19891950 - 160023895 x + 475755646 x^2 - 621674764 x^3 + 253625736 x^4 + 167604471 x^5 - 159891300 x^6 + 24097500 x^7
Oasis::Add add {
Oasis::Add {
Oasis::Add {
Oasis::Real { 222'126'775 },
Oasis::Real { 19'891'950 },
Oasis::Multiply {
Oasis::Real { -1'989'731'815 },
Oasis::Real { -160'023'895 },
Oasis::Variable { "x" } },
},
Oasis::Add {
Oasis::Multiply {
Oasis::Real { 6'674'884'402 },
Oasis::Real { 475'755'646 },
Oasis::Exponent {
Oasis::Variable { "x" },
Oasis::Real { 2 } } },
Oasis::Multiply {
Oasis::Real { -9'967'889'122 },
Oasis::Real { -621'674'764 },
Oasis::Exponent {
Oasis::Variable { "x" },
Oasis::Real { 3 } } },
} },
Oasis::Add {
Oasis::Add {
Oasis::Multiply {
Oasis::Real { 5'069'070'055 },
Oasis::Real { 253'625'736 },
Oasis::Exponent {
Oasis::Variable { "x" },
Oasis::Real { 4 } } },
Oasis::Multiply {
Oasis::Real { 2'370'752'969 },
Oasis::Real { 167'604'471 },
Oasis::Exponent {
Oasis::Variable { "x" },
Oasis::Real { 5 } } },
},
Oasis::Add {
Oasis::Multiply {
Oasis::Real { -2'841'027'600 },
Oasis::Real { -159'891'300 },
Oasis::Exponent {
Oasis::Variable { "x" },
Oasis::Real { 6 } } },
Oasis::Multiply {
Oasis::Real { 446'760'000 },
Oasis::Real { 24'097'500 },
Oasis::Exponent {
Oasis::Variable { "x" },
Oasis::Real { 7 } } },
} }
};
auto zeros = add.FindZeros();
REQUIRE(zeros.size() == 6);
std::set<std::tuple<long, long>> goalSet = { std::tuple(1, 3), std::tuple(67, 73), std::tuple(13, 17), std::tuple(-5, 3), std::tuple(101, 200), std::tuple(5, 1) };
std::set<std::tuple<long, long>> goalSet = { std::tuple(1, 3), std::tuple(6, 7), std::tuple(13, 17), std::tuple(-5, 3), std::tuple(101, 150), std::tuple(5, 1) };
for (auto& i : zeros) {
auto divideCase = Oasis::Divide<Oasis::Real>::Specialize(*i);
REQUIRE(divideCase != nullptr);
Expand Down

0 comments on commit aa82bb0

Please sign in to comment.