@@ -191,18 +191,41 @@ class GetAggregatePrice_test : public beast::unit_test::suite
191191 // Aggregate data set includes all price oracle instances, no trimming
192192 // or time threshold
193193 {
194- Env env (*this );
195- OraclesData oracles;
196- prep (env, oracles);
197- // entire and trimmed stats
198- auto ret = Oracle::aggregatePrice (env, " XRP" , " USD" , oracles);
199- BEAST_EXPECT (ret[jss::entire_set][jss::mean] == " 74.45" );
200- BEAST_EXPECT (ret[jss::entire_set][jss::size].asUInt () == 10 );
201- BEAST_EXPECT (
202- ret[jss::entire_set][jss::standard_deviation] ==
203- " 0.3027650354097492" );
204- BEAST_EXPECT (ret[jss::median] == " 74.45" );
205- BEAST_EXPECT (ret[jss::time] == 946694900 );
194+ auto const all = testable_amendments ();
195+ for (auto const & feats :
196+ {all - featureSingleAssetVault /* -
197+ featureLendingProtocol */
198+ ,
199+ all})
200+ {
201+ for (auto const mantissaSize :
202+ {MantissaRange::small, MantissaRange::large})
203+ {
204+ // Regardless of the features enabled, RPC is controlled by
205+ // the global mantissa size. And since it's a thread-local,
206+ // overriding it locally won't make a difference either.
207+ // This will mean all RPC will use the default of "large".
208+ NumberMantissaScaleGuard mg (mantissaSize);
209+
210+ Env env (*this , feats);
211+ OraclesData oracles;
212+ prep (env, oracles);
213+ // entire and trimmed stats
214+ auto ret =
215+ Oracle::aggregatePrice (env, " XRP" , " USD" , oracles);
216+ BEAST_EXPECT (ret[jss::entire_set][jss::mean] == " 74.45" );
217+ BEAST_EXPECT (
218+ ret[jss::entire_set][jss::size].asUInt () == 10 );
219+ // Short: 0.3027650354097492
220+ BEAST_EXPECTS (
221+ ret[jss::entire_set][jss::standard_deviation] ==
222+ " 0.3027650354097491666" ,
223+ ret[jss::entire_set][jss::standard_deviation]
224+ .asString ());
225+ BEAST_EXPECT (ret[jss::median] == " 74.45" );
226+ BEAST_EXPECT (ret[jss::time] == 946694900 );
227+ }
228+ }
206229 }
207230
208231 // Aggregate data set includes all price oracle instances
@@ -215,15 +238,19 @@ class GetAggregatePrice_test : public beast::unit_test::suite
215238 Oracle::aggregatePrice (env, " XRP" , " USD" , oracles, 20 , 100 );
216239 BEAST_EXPECT (ret[jss::entire_set][jss::mean] == " 74.45" );
217240 BEAST_EXPECT (ret[jss::entire_set][jss::size].asUInt () == 10 );
218- BEAST_EXPECT (
241+ // Short: "0.3027650354097492",
242+ BEAST_EXPECTS (
219243 ret[jss::entire_set][jss::standard_deviation] ==
220- " 0.3027650354097492" );
244+ " 0.3027650354097491666" ,
245+ ret[jss::entire_set][jss::standard_deviation].asString ());
221246 BEAST_EXPECT (ret[jss::median] == " 74.45" );
222247 BEAST_EXPECT (ret[jss::trimmed_set][jss::mean] == " 74.45" );
223248 BEAST_EXPECT (ret[jss::trimmed_set][jss::size].asUInt () == 6 );
224- BEAST_EXPECT (
249+ // Short: "0.187082869338697",
250+ BEAST_EXPECTS (
225251 ret[jss::trimmed_set][jss::standard_deviation] ==
226- " 0.187082869338697" );
252+ " 0.1870828693386970693" ,
253+ ret[jss::trimmed_set][jss::standard_deviation].asString ());
227254 BEAST_EXPECT (ret[jss::time] == 946694900 );
228255 }
229256
@@ -274,15 +301,19 @@ class GetAggregatePrice_test : public beast::unit_test::suite
274301 Oracle::aggregatePrice (env, " XRP" , " USD" , oracles, 20 , " 200" );
275302 BEAST_EXPECT (ret[jss::entire_set][jss::mean] == " 74.6" );
276303 BEAST_EXPECT (ret[jss::entire_set][jss::size].asUInt () == 7 );
277- BEAST_EXPECT (
304+ // Short: 0.2160246899469287
305+ BEAST_EXPECTS (
278306 ret[jss::entire_set][jss::standard_deviation] ==
279- " 0.2160246899469287" );
307+ " 0.2160246899469286744" ,
308+ ret[jss::entire_set][jss::standard_deviation].asString ());
280309 BEAST_EXPECT (ret[jss::median] == " 74.6" );
281310 BEAST_EXPECT (ret[jss::trimmed_set][jss::mean] == " 74.6" );
282311 BEAST_EXPECT (ret[jss::trimmed_set][jss::size].asUInt () == 5 );
283- BEAST_EXPECT (
312+ // Short: 0.158113883008419
313+ BEAST_EXPECTS (
284314 ret[jss::trimmed_set][jss::standard_deviation] ==
285- " 0.158113883008419" );
315+ " 0.1581138830084189666" ,
316+ ret[jss::trimmed_set][jss::standard_deviation].asString ());
286317 BEAST_EXPECT (ret[jss::time] == 946694900 );
287318 }
288319
0 commit comments