diff --git a/Makefile b/Makefile index 04b1e36b..4d3182cc 100644 --- a/Makefile +++ b/Makefile @@ -393,7 +393,7 @@ test-list list-tests: test-runner ## Summarize the test results .PHONY: testmarks -testmarks: SUMMARYFLAGS+=-Stime +testmarks: SUMMARYFLAGS+=-spassed -Stime testmarks: $(TEST_CSV) $(BUILDDIR)/lfs.test.csv $(strip ./scripts/summary.py $(TEST_CSV) \ -bsuite \ diff --git a/scripts/cov.py b/scripts/cov.py index e75c76f3..0b44e2a2 100755 --- a/scripts/cov.py +++ b/scripts/cov.py @@ -154,10 +154,18 @@ class RFrac(co.namedtuple('RFrac', 'a,b')): def __mul__(self, other): return self.__class__(self.a * other.a, self.b + other.b) + def __eq__(self, other): + self_a, self_b = self if self.b.x else (RInt(1), RInt(1)) + other_a, other_b = other if other.b.x else (RInt(1), RInt(1)) + return self_a * other_b == other_a * self_b + + def __ne__(self, other): + return not self.__eq__(other) + def __lt__(self, other): - self_t = self.a.x/self.b.x if self.b.x else 1.0 - other_t = other.a.x/other.b.x if other.b.x else 1.0 - return (self_t, self.a.x) < (other_t, other.a.x) + self_a, self_b = self if self.b.x else (RInt(1), RInt(1)) + other_a, other_b = other if other.b.x else (RInt(1), RInt(1)) + return self_a * other_b < other_a * self_b def __gt__(self, other): return self.__class__.__lt__(other, self) diff --git a/scripts/summary.py b/scripts/summary.py index c41296e7..997d9d0d 100755 --- a/scripts/summary.py +++ b/scripts/summary.py @@ -220,10 +220,18 @@ class RFrac(co.namedtuple('RFrac', 'a,b')): def __mul__(self, other): return self.__class__(self.a * other.a, self.b + other.b) + def __eq__(self, other): + self_a, self_b = self if self.b.x else (RInt(1), RInt(1)) + other_a, other_b = other if other.b.x else (RInt(1), RInt(1)) + return self_a * other_b == other_a * self_b + + def __ne__(self, other): + return not self.__eq__(other) + def __lt__(self, other): - self_t = self.a.x/self.b.x if self.b.x else 1.0 - other_t = other.a.x/other.b.x if other.b.x else 1.0 - return (self_t, self.a.x) < (other_t, other.a.x) + self_a, self_b = self if self.b.x else (RInt(1), RInt(1)) + other_a, other_b = other if other.b.x else (RInt(1), RInt(1)) + return self_a * other_b < other_a * self_b def __gt__(self, other): return self.__class__.__lt__(other, self)