summaryrefslogtreecommitdiffstats
path: root/bindings/cpp/test/test_sratom_hpp.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-03-23 12:42:29 -0400
committerDavid Robillard <d@drobilla.net>2021-03-23 12:42:29 -0400
commitea02e3d48e3ff4ce6bea8de559efbec64da9b161 (patch)
treed6cbeca0058ab8983471d78046ef65281ff0d4c1 /bindings/cpp/test/test_sratom_hpp.cpp
parenta56c9d4c789c2294b3c5a4fb7b1e39b8b75e4eec (diff)
downloadsratom-ea02e3d48e3ff4ce6bea8de559efbec64da9b161.tar.gz
sratom-ea02e3d48e3ff4ce6bea8de559efbec64da9b161.tar.bz2
sratom-ea02e3d48e3ff4ce6bea8de559efbec64da9b161.zip
fixup! WIP: Add C++ bindings
Diffstat (limited to 'bindings/cpp/test/test_sratom_hpp.cpp')
-rw-r--r--bindings/cpp/test/test_sratom_hpp.cpp34
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;
}