From: fred Date: Wed, 11 Mar 1998 21:04:07 +0000 (+0000) Subject: lilypond-0.1.48 X-Git-Tag: release/1.5.59~6004 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=24edc235f27a7d99066c146482995e2d06d953a3;p=lilypond.git lilypond-0.1.48 --- diff --git a/flower/test/rattest.cc b/flower/test/rattest.cc new file mode 100644 index 0000000000..d2de9b2c12 --- /dev/null +++ b/flower/test/rattest.cc @@ -0,0 +1,39 @@ +#include +#include "rational.hh" +#include "flower-test.hh" +#include "string.hh" + + +#define EXP_PRINT(a) #a << ": " << (a) << "\n" + +void +rattest () +{ + Rational r (1,4); + Rational q(1,2); + Rational s(6,4); + Rational i; + i.set_infinite (1); + + cout << r << " " << s << " " << q << "\n"; + cout << r + q << " " << (s * q + s) << " " << (q / r) << "\n"; + cout << i; + cout << "inf * r" << i * r << "inf * inf " << i * i << "inf + r" << i + r; + cout << EXP_PRINT(-i); + cout << EXP_PRINT(i >? -i) << EXP_PRINT(i >? r); + cout << EXP_PRINT(i