From 2c6bc5afa59a88136fd6de4ebf0cb99ea7cdef3f Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 21 Aug 2013 14:06:57 -0700 Subject: SH-4433 WIP Interesting: Statistics > Ping Sim is always 0 ms made getPrimaryAccumulator return a reference since it was an always non-null pointer changed unit conversion to perform lazy division in order to avoid truncation of timer values --- indra/llcommon/tests/llunits_test.cpp | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'indra/llcommon/tests') diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp index a8e9be86ca..b8aef9d15e 100644 --- a/indra/llcommon/tests/llunits_test.cpp +++ b/indra/llcommon/tests/llunits_test.cpp @@ -38,12 +38,9 @@ namespace LLUnits LL_DECLARE_DERIVED_UNIT(Latinum, / 16, Solari, "Sol"); } -typedef LLUnit F32Quatloos; -typedef LLUnit S32Quatloos; -typedef LLUnit F32Latinum; -typedef LLUnit S32Latinum; -typedef LLUnit F32Solari; -typedef LLUnit S32Solari; +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Quatloos); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Latinum); +LL_DECLARE_UNIT_TYPEDEFS(LLUnits, Solari); namespace tut { @@ -83,6 +80,15 @@ namespace tut LLUnit unsigned_int_quatloos(float_quatloos); ensure("unsigned int can be initialized from signed int", unsigned_int_quatloos == S32Quatloos(42)); + + S32Solari int_solari(1); + + float_quatloos = int_solari; + ensure("fractional units are preserved in conversion from integer to float type", float_quatloos == F32Quatloos(0.25f)); + + int_quatloos = S32Quatloos(1); + F32Solari float_solari = int_quatloos; + ensure("can convert with fractional intermediates from integer to float type", float_solari == F32Solari(4.f)); } // conversions to/from base unit @@ -185,6 +191,11 @@ namespace tut return true; } + bool accept_implicit_quatloos(S32Quatloos q) + { + return true; + } + // signature compatibility template<> template<> void units_object_t::test<6>() -- cgit v1.2.3