diff options
Diffstat (limited to 'bindings/cpp/test')
-rw-r--r-- | bindings/cpp/test/test_sratom_hpp.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
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\"^^<http://www.w3.org/2001/XMLSchema#int> ) .\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; } |