GlideAngle / flare-timing

Scoring for free flight competitions.
Mozilla Public License 2.0
11 stars 2 forks source link

The testsuite flight-gap-math fails #529

Closed philderbeast closed 3 years ago

philderbeast commented 3 years ago
> stack test flight-gap-math:math
...
Tests
  Units
    Points
      HG Points
        ESS but no goal
          ✓ Sum of reach, effort, leading, 80% of time & arrival points:                      FAIL
            test-suite-math/Points/Hg.hs:326:
            expected: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
             but got: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
          ✓ With jump penalty fraction = 1 (the identity of multiplication):                  FAIL
            test-suite-math/Points/Hg.hs:336:
            expected: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
             but got: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
          ✘ With jump penalty points = 0 (the identity of addition):                          FAIL
            test-suite-math/Points/Hg.hs:346:
            expected: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
             but got: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
          ✘ With jump reset = ∅ (the identity of reset):                                      FAIL
            test-suite-math/Points/Hg.hs:356:
            expected: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
             but got: Right (PointsReduced {subtotal = 5.000, mulApplied = 0.000, addApplied = 0.400, resetApplied = 0.000, total = 4.600, effp = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, effj = PenaltySeq {mul = (* id), add = (+ id), reset = (= id)}, effg = PenaltySeq {mul = (* id), add = (- 0.4), reset = (= id)}, rawj = PenaltySeqs {muls = [], adds = [], resets = []}})
...

4 out of 91 tests failed (0.11s)

flight-gap-math> Test suite math failed
Completed 2 action(s).
Test suite failure for package flight-gap-math-0.1.0
    math:  exited with: ExitFailure 1
Logs printed to console
philderbeast commented 3 years ago

Related to #500?

philderbeast commented 3 years ago

The problem is with the addApplied field:

expected: Right 0.4
 but got: Right 0.40000000000000036
philderbeast commented 3 years ago

Use onPointsReduced (dpRound 8) before doing comparisons.