From ea02e3d48e3ff4ce6bea8de559efbec64da9b161 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 23 Mar 2021 12:42:29 -0400 Subject: fixup! WIP: Add C++ bindings --- bindings/cpp/test/test_sratom_hpp.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'bindings/cpp/test') diff --git a/bindings/cpp/test/test_sratom_hpp.cpp b/bindings/cpp/test/test_sratom_hpp.cpp index 2ada056..4825f8d 100644 --- a/bindings/cpp/test/test_sratom_hpp.cpp +++ b/bindings/cpp/test/test_sratom_hpp.cpp @@ -16,10 +16,44 @@ #undef NDEBUG +#include "test_utils.h" + +#include "lv2/urid/urid.h" +#include "serd/serd.hpp" #include "sratom/sratom.hpp" +namespace sratom { +namespace test { +namespace { + +void +test_dumper() +{ + serd::World world; + serd::Env env; + Uris uris{nullptr, 0}; + LV2_URID_Map map{&uris, urid_map}; + LV2_URID_Unmap unmap{&uris, urid_unmap}; + Dumper dumper{world, map, unmap}; + + const LV2_Atom_Int a_int = {{sizeof(int32_t), urid_map(&uris, LV2_ATOM__Int)}, + 42}; + + assert(dumper.to_string(env, a_int.atom, {}) == + "( \"42\"^^ ) .\n"); + + assert(dumper.to_string(env, a_int.atom, sratom::Flag::pretty_numbers) == + "( 42 ) .\n"); +} + +} // namespace +} // namespace test +} // namespace sratom + int main() { + sratom::test::test_dumper(); + return 0; } -- cgit v1.2.1