Fix some portability issues with cxx_callback_datatype test case
diff --git a/tests/SConstruct b/tests/SConstruct
index fb578fd..cd65145 100644
--- a/tests/SConstruct
+++ b/tests/SConstruct
@@ -61,7 +61,7 @@
# On Mac OS X, gcc is usually alias for clang.
# To avoid problem with default options, use clang directly.
if platform.system() == "Darwin" and 'CC' not in ARGUMENTS:
- env.Replace(CC = "clang", CXX = "clang")
+ env.Replace(CC = "clang", CXX = "clang++")
# Add the builders defined in site_init.py
add_nanopb_builders(env)
diff --git a/tests/cxx_callback_datatype/SConscript b/tests/cxx_callback_datatype/SConscript
index 4cb1a97..ecdab0b 100644
--- a/tests/cxx_callback_datatype/SConscript
+++ b/tests/cxx_callback_datatype/SConscript
@@ -16,7 +16,7 @@
# Make sure compiler supports this version of C++ before we actually run the
# test.
conf = Configure(e)
- compiler_valid = conf.CheckCXX()
+ compiler_valid = conf.CheckCXX() and conf.CheckCXXHeader('vector')
e = conf.Finish()
if not compiler_valid:
print("Skipping {} test - compiler doesn't support it".format(std))
diff --git a/tests/cxx_callback_datatype/cxx_callback_datatype.cpp b/tests/cxx_callback_datatype/cxx_callback_datatype.cpp
index da76bc7..52f2742 100644
--- a/tests/cxx_callback_datatype/cxx_callback_datatype.cpp
+++ b/tests/cxx_callback_datatype/cxx_callback_datatype.cpp
@@ -69,16 +69,16 @@
}
if (source != destination) {
fprintf(stderr, "Result does not match\n");
- fprintf(stderr, "source(%lu): ", source.size());
+ fprintf(stderr, "source(%d): ", (int)source.size());
for (std::vector<int>::iterator i = source.begin(); i != source.end(); ++i)
{
fprintf(stderr, "%d, ", *i);
}
- fprintf(stderr, "\nencoded(%lu): ", serialized.size());
+ fprintf(stderr, "\nencoded(%d): ", (int)serialized.size());
for (unsigned i = 0; i != std::min(serialized.size(), outstream.bytes_written); ++i) {
- fprintf(stderr, "%#06x ", serialized[i]);
+ fprintf(stderr, "0x%02x ", serialized[i]);
}
- fprintf(stderr, "\ndestination(%lu): ", destination.size());
+ fprintf(stderr, "\ndestination(%d): ", (int)destination.size());
for (std::vector<int>::iterator i = destination.begin(); i != destination.end(); ++i)
{
fprintf(stderr, "%d, ", *i);