diff options
Diffstat (limited to 'tests/test_macros.h')
-rw-r--r-- | tests/test_macros.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/test_macros.h b/tests/test_macros.h index e4494ce11a..45ba8581dd 100644 --- a/tests/test_macros.h +++ b/tests/test_macros.h @@ -47,4 +47,61 @@ #define ERR_PRINT_OFF _print_error_enabled = false; #define ERR_PRINT_ON _print_error_enabled = true; +// Stringify all `Variant` compatible types for doctest output by default. +// https://github.com/onqtam/doctest/blob/master/doc/markdown/stringification.md + +#define DOCTEST_STRINGIFY_VARIANT(m_type) \ + template <> \ + struct doctest::StringMaker<m_type> { \ + static doctest::String convert(const m_type &p_val) { \ + const Variant val = p_val; \ + return val.get_construct_string().utf8().get_data(); \ + } \ + }; + +#define DOCTEST_STRINGIFY_VARIANT_POINTER(m_type) \ + template <> \ + struct doctest::StringMaker<m_type> { \ + static doctest::String convert(const m_type *p_val) { \ + const Variant val = p_val; \ + return val.get_construct_string().utf8().get_data(); \ + } \ + }; + +DOCTEST_STRINGIFY_VARIANT(Variant); +DOCTEST_STRINGIFY_VARIANT(::String); // Disambiguate from `doctest::String`. + +DOCTEST_STRINGIFY_VARIANT(Vector2); +DOCTEST_STRINGIFY_VARIANT(Vector2i); +DOCTEST_STRINGIFY_VARIANT(Rect2); +DOCTEST_STRINGIFY_VARIANT(Rect2i); +DOCTEST_STRINGIFY_VARIANT(Vector3); +DOCTEST_STRINGIFY_VARIANT(Vector3i); +DOCTEST_STRINGIFY_VARIANT(Transform2D); +DOCTEST_STRINGIFY_VARIANT(Plane); +DOCTEST_STRINGIFY_VARIANT(Quat); +DOCTEST_STRINGIFY_VARIANT(AABB); +DOCTEST_STRINGIFY_VARIANT(Basis); +DOCTEST_STRINGIFY_VARIANT(Transform); + +DOCTEST_STRINGIFY_VARIANT(::Color); // Disambiguate from `doctest::Color`. +DOCTEST_STRINGIFY_VARIANT(StringName); +DOCTEST_STRINGIFY_VARIANT(NodePath); +DOCTEST_STRINGIFY_VARIANT(RID); +DOCTEST_STRINGIFY_VARIANT_POINTER(Object); +DOCTEST_STRINGIFY_VARIANT(Callable); +DOCTEST_STRINGIFY_VARIANT(Signal); +DOCTEST_STRINGIFY_VARIANT(Dictionary); +DOCTEST_STRINGIFY_VARIANT(Array); + +DOCTEST_STRINGIFY_VARIANT(PackedByteArray); +DOCTEST_STRINGIFY_VARIANT(PackedInt32Array); +DOCTEST_STRINGIFY_VARIANT(PackedInt64Array); +DOCTEST_STRINGIFY_VARIANT(PackedFloat32Array); +DOCTEST_STRINGIFY_VARIANT(PackedFloat64Array); +DOCTEST_STRINGIFY_VARIANT(PackedStringArray); +DOCTEST_STRINGIFY_VARIANT(PackedVector2Array); +DOCTEST_STRINGIFY_VARIANT(PackedVector3Array); +DOCTEST_STRINGIFY_VARIANT(PackedColorArray); + #endif // TEST_MACROS_H |