fuzzylite / jfuzzylite

jfuzzylite: a fuzzy logic control library in Java
https://fuzzylite.com/
GNU General Public License v3.0
42 stars 21 forks source link

Failing test in rule addition #11

Closed ssaarinen closed 2 years ago

ssaarinen commented 6 years ago

Specifying rule weight was also something that I found a bit confusing. This pull request contains a failing test for setting rule weight in the rule object directly. Also couple of other test that seem to work. Changing the weight and asserting that the changed weight is actually used is something that might be missing from the last test.

jcrada commented 6 years ago

Thanks again for your contribution. The solution to the failing test is to get rid of the constructor Rule(String text, double weight). It is a misleading constructor. The problem happens when loading the rule, which parses the rule based on the rule text. In your test, the rule text does not contain the with 0.5, hence assuming a weight of 1.0. Would you like to fix this? If so, would you please make the changes, keep the tests, and PR to develop? Thanks!

ssaarinen commented 6 years ago

I rebased PR to develop and added some documentation to the misleading constructor. As stated there it might be better to make is less visible to client code in the future.