summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests/llunits_test.cpp
diff options
context:
space:
mode:
authorRichard Linden <none@none>2013-08-22 17:00:49 -0700
committerRichard Linden <none@none>2013-08-22 17:00:49 -0700
commitc95d0b884371045a46c345d43fab90b5f3d6ccb2 (patch)
tree11890b80ee908223f9ff60964738f2a4cfadc576 /indra/llcommon/tests/llunits_test.cpp
parent3413a57a90094b1844fbc837d5ce24921c87e600 (diff)
parentcf014375b8b408d58bd35deb4e58e4369fb3bf62 (diff)
merge
Diffstat (limited to 'indra/llcommon/tests/llunits_test.cpp')
-rw-r--r--indra/llcommon/tests/llunits_test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/indra/llcommon/tests/llunits_test.cpp b/indra/llcommon/tests/llunits_test.cpp
index b8aef9d15e..292c6122af 100644
--- a/indra/llcommon/tests/llunits_test.cpp
+++ b/indra/llcommon/tests/llunits_test.cpp
@@ -257,4 +257,20 @@ namespace tut
LLUnitImplicit<F32, Latinum> latinum_implicit(2);
ensure("implicit units of different types are comparable", latinum_implicit * 2 == quatloos_implicit);
}
+
+ // precision tests
+ template<> template<>
+ void units_object_t::test<8>()
+ {
+ U32Bytes max_bytes(U32_MAX);
+ S32Megabytes mega_bytes = max_bytes;
+ ensure("max available precision is used when converting units", mega_bytes == (S32Megabytes)4095);
+
+ mega_bytes = (S32Megabytes)-5 + (U32Megabytes)1;
+ ensure("can mix signed and unsigned in units addition", mega_bytes == (S32Megabytes)-4);
+
+ mega_bytes = (U32Megabytes)5 + (S32Megabytes)-1;
+ ensure("can mix unsigned and signed in units addition", mega_bytes == (S32Megabytes)4);
+
+ }
}