From 2ce5ddc295bc388903371064ff7a332f1c8d7f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20M=C3=BCller?= Date: Fri, 21 Apr 2017 11:56:39 +0200 Subject: [PATCH] Fix compatibility issue in enum test --- test/cpp_enum.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/cpp_enum.cpp b/test/cpp_enum.cpp index 53c62bb..8b70cf0 100644 --- a/test/cpp_enum.cpp +++ b/test/cpp_enum.cpp @@ -77,21 +77,29 @@ enum ns::c : int {}; ++no_vals; REQUIRE(val.value()); auto& expr = val.value().value(); - REQUIRE(expr.kind() == cpp_expression_kind::unexposed_t); - REQUIRE(static_cast(expr).expression() - == "42"); - REQUIRE(equal_types(idx, expr.type(), *cpp_builtin_type::build(cpp_uint))); + if (equal_types(idx, expr.type(), *cpp_builtin_type::build(cpp_uint))) + { + REQUIRE(expr.kind() == cpp_expression_kind::unexposed_t); + REQUIRE(static_cast(expr).expression() + == "42"); + } + else + { + REQUIRE(equal_types(idx, expr.type(), *cpp_builtin_type::build(cpp_int))); + REQUIRE(expr.kind() == cpp_expression_kind::literal_t); + REQUIRE(static_cast(expr).value() == "42"); + } } else if (val.name() == "a_d") { ++no_vals; REQUIRE(val.value()); auto& expr = val.value().value(); - // this is unexposed for some reason REQUIRE(expr.kind() == cpp_expression_kind::unexposed_t); REQUIRE(static_cast(expr).expression() == "a_a+2"); - REQUIRE(equal_types(idx, expr.type(), *cpp_builtin_type::build(cpp_uint))); + if (!equal_types(idx, expr.type(), *cpp_builtin_type::build(cpp_int))) + REQUIRE(equal_types(idx, expr.type(), *cpp_builtin_type::build(cpp_uint))); } else REQUIRE(false);