• Home
  • Raw
  • Download

Lines Matching refs:fq

52 void DecimalQuantityTest::assertHealth(const DecimalQuantity &fq) {  in assertHealth()  argument
53 const char16_t* health = fq.checkHealth(); in assertHealth()
55 errln(UnicodeString(u"HEALTH FAILURE: ") + UnicodeString(health) + u": " + fq.toString()); in assertHealth()
60 DecimalQuantityTest::assertToStringAndHealth(const DecimalQuantity &fq, const UnicodeString &expect… in assertToStringAndHealth() argument
61 UnicodeString actual = fq.toString(); in assertToStringAndHealth()
63 assertHealth(fq); in assertToStringAndHealth()
67 DecimalQuantity fq; in checkDoubleBehavior() local
68 fq.setToDouble(d); in checkDoubleBehavior()
70 assertTrue("Should be using approximate double", !fq.isExplicitExactDouble()); in checkDoubleBehavior()
72 UnicodeString baseStr = fq.toString(); in checkDoubleBehavior()
73 fq.roundToInfinity(); in checkDoubleBehavior()
74 UnicodeString newStr = fq.toString(); in checkDoubleBehavior()
76 assertTrue("Should not be using approximate double", fq.isExplicitExactDouble()); in checkDoubleBehavior()
80 d, fq.toDouble()); in checkDoubleBehavior()
85 DecimalQuantity fq; in testDecimalQuantityBehaviorStandalone() local
86 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 long 0E0>"); in testDecimalQuantityBehaviorStandalone()
87 fq.setToInt(51423); in testDecimalQuantityBehaviorStandalone()
88 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 long 51423E0>"); in testDecimalQuantityBehaviorStandalone()
89 fq.adjustMagnitude(-3); in testDecimalQuantityBehaviorStandalone()
90 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 long 51423E-3>"); in testDecimalQuantityBehaviorStandalone()
92 fq.setToLong(90909090909000L); in testDecimalQuantityBehaviorStandalone()
93 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 long 90909090909E3>"); in testDecimalQuantityBehaviorStandalone()
94 fq.setMinInteger(2); in testDecimalQuantityBehaviorStandalone()
95 fq.applyMaxInteger(5); in testDecimalQuantityBehaviorStandalone()
96 assertToStringAndHealth(fq, u"<DecimalQuantity 2:0 long 9E3>"); in testDecimalQuantityBehaviorStandalone()
97 fq.setMinFraction(3); in testDecimalQuantityBehaviorStandalone()
98 assertToStringAndHealth(fq, u"<DecimalQuantity 2:-3 long 9E3>"); in testDecimalQuantityBehaviorStandalone()
100 fq.setToDouble(987.654321); in testDecimalQuantityBehaviorStandalone()
101 assertToStringAndHealth(fq, u"<DecimalQuantity 2:-3 long 987654321E-6>"); in testDecimalQuantityBehaviorStandalone()
102 fq.roundToInfinity(); in testDecimalQuantityBehaviorStandalone()
103 assertToStringAndHealth(fq, u"<DecimalQuantity 2:-3 long 987654321E-6>"); in testDecimalQuantityBehaviorStandalone()
104 fq.roundToIncrement(0.005, RoundingMode::UNUM_ROUND_HALFEVEN, status); in testDecimalQuantityBehaviorStandalone()
106 assertToStringAndHealth(fq, u"<DecimalQuantity 2:-3 long 987655E-3>"); in testDecimalQuantityBehaviorStandalone()
107 fq.roundToMagnitude(-2, RoundingMode::UNUM_ROUND_HALFEVEN, status); in testDecimalQuantityBehaviorStandalone()
109 assertToStringAndHealth(fq, u"<DecimalQuantity 2:-3 long 98766E-2>"); in testDecimalQuantityBehaviorStandalone()
114 DecimalQuantity fq; in testSwitchStorage() local
116 fq.setToLong(1234123412341234L); in testSwitchStorage()
117 assertFalse("Should not be using byte array", fq.isUsingBytes()); in testSwitchStorage()
118 assertEquals("Failed on initialize", u"1.234123412341234E+15", fq.toScientificString()); in testSwitchStorage()
119 assertHealth(fq); in testSwitchStorage()
121 fq.appendDigit(5, 0, true); in testSwitchStorage()
122 assertTrue("Should be using byte array", fq.isUsingBytes()); in testSwitchStorage()
123 assertEquals("Failed on multiply", u"1.2341234123412345E+16", fq.toScientificString()); in testSwitchStorage()
124 assertHealth(fq); in testSwitchStorage()
126 fq.roundToMagnitude(5, RoundingMode::UNUM_ROUND_HALFEVEN, status); in testSwitchStorage()
128 assertFalse("Should not be using byte array", fq.isUsingBytes()); in testSwitchStorage()
129 assertEquals("Failed on round", u"1.23412341234E+16", fq.toScientificString()); in testSwitchStorage()
130 assertHealth(fq); in testSwitchStorage()
132 fq.setToDecNumber({"999999999999999999"}, status); in testSwitchStorage()
133 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 bytes 999999999999999999E0>"); in testSwitchStorage()
134 fq.applyMaxInteger(17); in testSwitchStorage()
135 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 bytes 99999999999999999E0>"); in testSwitchStorage()
136 fq.applyMaxInteger(16); in testSwitchStorage()
137 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 long 9999999999999999E0>"); in testSwitchStorage()
138 fq.applyMaxInteger(15); in testSwitchStorage()
139 assertToStringAndHealth(fq, u"<DecimalQuantity 0:0 long 999999999999999E0>"); in testSwitchStorage()
190 DecimalQuantity fq; in testAppend() local
191 fq.appendDigit(1, 0, true); in testAppend()
192 assertEquals("Failed on append", u"1E+0", fq.toScientificString()); in testAppend()
193 assertHealth(fq); in testAppend()
194 fq.appendDigit(2, 0, true); in testAppend()
195 assertEquals("Failed on append", u"1.2E+1", fq.toScientificString()); in testAppend()
196 assertHealth(fq); in testAppend()
197 fq.appendDigit(3, 1, true); in testAppend()
198 assertEquals("Failed on append", u"1.203E+3", fq.toScientificString()); in testAppend()
199 assertHealth(fq); in testAppend()
200 fq.appendDigit(0, 1, true); in testAppend()
201 assertEquals("Failed on append", u"1.203E+5", fq.toScientificString()); in testAppend()
202 assertHealth(fq); in testAppend()
203 fq.appendDigit(4, 0, true); in testAppend()
204 assertEquals("Failed on append", u"1.203004E+6", fq.toScientificString()); in testAppend()
205 assertHealth(fq); in testAppend()
206 fq.appendDigit(0, 0, true); in testAppend()
207 assertEquals("Failed on append", u"1.203004E+7", fq.toScientificString()); in testAppend()
208 assertHealth(fq); in testAppend()
209 fq.appendDigit(5, 0, false); in testAppend()
210 assertEquals("Failed on append", u"1.20300405E+7", fq.toScientificString()); in testAppend()
211 assertHealth(fq); in testAppend()
212 fq.appendDigit(6, 0, false); in testAppend()
213 assertEquals("Failed on append", u"1.203004056E+7", fq.toScientificString()); in testAppend()
214 assertHealth(fq); in testAppend()
215 fq.appendDigit(7, 3, false); in testAppend()
216 assertEquals("Failed on append", u"1.2030040560007E+7", fq.toScientificString()); in testAppend()
217 assertHealth(fq); in testAppend()
220 fq.appendDigit(8, 0, false); in testAppend()
224 assertEquals("Failed on append", expected, fq.toScientificString()); in testAppend()
225 assertHealth(fq); in testAppend()
227 fq.appendDigit(9, 2, false); in testAppend()
231 assertEquals("Failed on append", expected, fq.toScientificString()); in testAppend()
232 assertHealth(fq); in testAppend()
321 DecimalQuantity fq; in testUseApproximateDoubleWhenAble() local
322 fq.setToDouble(cas.d); in testUseApproximateDoubleWhenAble()
323 assertTrue("Should be using approximate double", !fq.isExplicitExactDouble()); in testUseApproximateDoubleWhenAble()
324 fq.roundToMagnitude(-cas.maxFrac, cas.roundingMode, status); in testUseApproximateDoubleWhenAble()
326 if (cas.usesExact != fq.isExplicitExactDouble()) { in testUseApproximateDoubleWhenAble()
327 errln(UnicodeString(u"Using approximate double after rounding: ") + fq.toString()); in testUseApproximateDoubleWhenAble()