summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-08-21 14:06:57 -0700
committerRichard Linden <none@none>2013-08-21 14:06:57 -0700
commit2c6bc5afa59a88136fd6de4ebf0cb99ea7cdef3f (patch)
treec91e15225fc14b0ea753d8188199f8e7f806e7a5 /indra/llcommon/tests
parent6d9af374066421a1d8465a57795250a1614adcbb (diff)
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
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r--indra/llcommon/tests/llunits_test.cpp23
1 files changed, 17 insertions, 6 deletions
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<F32, LLUnits::Quatloos> F32Quatloos;
-typedef LLUnit<S32, LLUnits::Quatloos> S32Quatloos;
-typedef LLUnit<F32, LLUnits::Latinum> F32Latinum;
-typedef LLUnit<S32, LLUnits::Latinum> S32Latinum;
-typedef LLUnit<F32, LLUnits::Solari> F32Solari;
-typedef LLUnit<S32, LLUnits::Solari> 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<U32, Quatloos> 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>()