Skip to content

Commit

Permalink
Test: Norms
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrada committed Mar 7, 2024
1 parent 0e91f81 commit 1b06e2e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ install:

coverage:
# pip install gcovr
gcovr -r src/ build/CMakeFiles/fl-test.dir/ --coveralls build/coveralls.json --html build/coverage.html --html-details --sort uncovered-percent --html-theme github.dark-blue --txt --txt-summary --filter src/norm
gcovr -r src/ build/CMakeFiles/fl-test.dir/ --coveralls build/coveralls.json --html build/coverage.html --html-details --sort uncovered-percent --html-theme github.dark-blue --txt --txt-summary
# open build/coverage.html

clean-coverage:
Expand Down
29 changes: 23 additions & 6 deletions test/TestNorm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ namespace fuzzylite {
{1.00, 0.50, 0.50},
{1.00, 0.75, 0.75},
{1.00, 1.00, 1.00},
// {nan, nan, nan},
{nan, nan, nan},
{inf, inf, inf},
// {inf, -inf, nan},
{inf, -inf, nan},
{-inf, -inf, 0},
});
}
Expand Down Expand Up @@ -244,7 +244,7 @@ namespace fuzzylite {
{1.00, 1.00, 1.00},
{nan, nan, nan},
{inf, inf, inf},
// {inf, -inf, -inf},
{inf, -inf, -inf},
{-inf, -inf, -inf},
});
}
Expand Down Expand Up @@ -327,6 +327,15 @@ namespace fuzzylite {
{inf, -inf, nan},
{-inf, -inf, -inf},
});

auto f = TNormFunction("a*b");
CHECK(f.getFormula() == "a*b");
f.setFormula("(a*b)/2");
CHECK(f.getFormula() == "(a*b)/2");
CHECK(f.function().isLoaded());
const auto constructor
= FL_unique_ptr<TNormFunction>(dynamic_cast<TNormFunction*>(TNormFunction::constructor()));
CHECK(not constructor->function().isLoaded());
}

SECTION("BoundedSum") {
Expand All @@ -348,9 +357,9 @@ namespace fuzzylite {
{1.00, 0.50, 1.00},
{1.00, 0.75, 1.00},
{1.00, 1.00, 1.00},
// {nan, nan, nan},
{nan, nan, nan},
{inf, inf, 1.0},
// {inf, -inf, nan},
{inf, -inf, nan},
{-inf, -inf, -inf},
});
}
Expand Down Expand Up @@ -452,7 +461,7 @@ namespace fuzzylite {
{1.00, 1.00, 1.00},
{nan, nan, nan},
{inf, inf, inf},
// {inf, -inf, inf},
{inf, -inf, inf},
{-inf, -inf, -inf},
});
}
Expand Down Expand Up @@ -555,6 +564,14 @@ namespace fuzzylite {
{inf, -inf, nan},
{-inf, -inf, -inf},
});
auto f = SNormFunction("a+b");
CHECK(f.getFormula() == "a+b");
f.setFormula("(a+b)/2");
CHECK(f.getFormula() == "(a+b)/2");
CHECK(f.function().isLoaded());
const auto constructor
= FL_unique_ptr<SNormFunction>(dynamic_cast<SNormFunction*>(SNormFunction::constructor()));
CHECK(not constructor->function().isLoaded());
}
}

Expand Down

0 comments on commit 1b06e2e

Please sign in to comment.