From b4f1887b037e4ec5db978a10b8970a7a51ed60c9 Mon Sep 17 00:00:00 2001 From: Adam Cimarosti Date: Wed, 31 Jan 2024 11:02:17 +0000 Subject: [PATCH] documented running C++ tests and added namespace to conf_str.hpp --- README.md | 19 +++++++++++++++++++ questdb-confstr-ffi/cpp_test/test.cpp | 2 ++ .../include/questdb/conf_str.hpp | 4 ++++ questdb-confstr/tests/tests.rs | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e4ff33b..d448a0b 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,22 @@ This is for: * The [questdb-confstr](./questdb-confstr) crate * and its bindings for C [questdb-confstr-ffi](./questdb-confstr-ffi) + +## Dev notes + +To build and test: + +``` +cargo clean +cargo build +cargo test +cd questdb-confstr-ffi/cpp_test +./compile +./run +``` + +In addition, before pushing a PR, please run: +``` +cargo fmt --all +cargo clippy --all-targets -- -D warnings +``` \ No newline at end of file diff --git a/questdb-confstr-ffi/cpp_test/test.cpp b/questdb-confstr-ffi/cpp_test/test.cpp index decca7a..fd4188c 100644 --- a/questdb-confstr-ffi/cpp_test/test.cpp +++ b/questdb-confstr-ffi/cpp_test/test.cpp @@ -30,6 +30,8 @@ #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN #include "doctest.hpp" +using namespace questdb::conf_str; + TEST_CASE("basic no params") { const auto c1 = conf_str::parse("http"); diff --git a/questdb-confstr-ffi/include/questdb/conf_str.hpp b/questdb-confstr-ffi/include/questdb/conf_str.hpp index fc3bca1..cfb9452 100644 --- a/questdb-confstr-ffi/include/questdb/conf_str.hpp +++ b/questdb-confstr-ffi/include/questdb/conf_str.hpp @@ -5,6 +5,8 @@ #include #include +namespace questdb::conf_str +{ class parse_err { @@ -157,3 +159,5 @@ class conf_str conf_str(::questdb_conf_str* impl) : _impl(impl) {} ::questdb_conf_str* _impl; }; + +} diff --git a/questdb-confstr/tests/tests.rs b/questdb-confstr/tests/tests.rs index c304d9f..951b223 100644 --- a/questdb-confstr/tests/tests.rs +++ b/questdb-confstr/tests/tests.rs @@ -22,8 +22,8 @@ * ******************************************************************************/ -use std::collections::HashMap; use questdb_confstr::{parse_conf_str, ErrorKind, ParsingError}; +use std::collections::HashMap; #[test] fn empty() -> Result<(), ParsingError> {