diff --git a/test/unit.cpp b/test/unit.cpp index 9dc13ea..78b9bbb 100644 --- a/test/unit.cpp +++ b/test/unit.cpp @@ -250,6 +250,14 @@ TEST_CASE( "implicit conversion to first type in variant type list", "[variant][ REQUIRE_THROWS(var.get()); } +// test case to help debugging https://github.com/mapbox/variant/issues/25 +TEST_CASE( "implicit conversion to unsigned char", "[variant][implicit conversion]" ) { + typedef util::variant variant_type; + variant_type var = 500.0; // converted to unsigned char, even if it doesn't fit + CHECK(var.get() == static_cast(500.0)); + CHECK(var.get() == static_cast(static_cast(500.0))); +} + struct dummy {}; TEST_CASE( "implicit conversion to first type it can convert to even if it doesn't fit", "[variant][implicit conversion]" ) {