diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/build/root.build | 5 | ||||
-rw-r--r-- | tests/next-word/buildfile | 6 | ||||
-rw-r--r-- | tests/next-word/driver.cxx | 46 | ||||
-rw-r--r-- | tests/odb/buildfile | 6 | ||||
l--------- | tests/odb/driver.cxx | 1 | ||||
-rw-r--r-- | tests/pkg-config/buildfile | 6 | ||||
l--------- | tests/pkg-config/driver.c | 1 | ||||
l--------- | tests/pkg-config/testscript | 1 |
8 files changed, 70 insertions, 2 deletions
diff --git a/tests/build/root.build b/tests/build/root.build index 515e1c9..5ce7156 100644 --- a/tests/build/root.build +++ b/tests/build/root.build @@ -4,15 +4,16 @@ cxx.std = latest using cxx +using c hxx{*}: extension = hxx cxx{*}: extension = cxx if ($cxx.target.system == 'win32-msvc') - cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS + cc.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS if ($cxx.class == 'msvc') - cxx.coptions += /wd4251 /wd4275 /wd4800 + cc.coptions += /wd4251 /wd4275 /wd4800 elif ($cxx.id == 'gcc') { cxx.coptions += -Wno-maybe-uninitialized -Wno-free-nonheap-object \ diff --git a/tests/next-word/buildfile b/tests/next-word/buildfile new file mode 100644 index 0000000..e06cd88 --- /dev/null +++ b/tests/next-word/buildfile @@ -0,0 +1,6 @@ +# file : tests/next-word/buildfile +# license : MIT; see accompanying LICENSE file + +import libs = libbutl%lib{butl} + +exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/next-word/driver.cxx b/tests/next-word/driver.cxx new file mode 100644 index 0000000..4ebe1a5 --- /dev/null +++ b/tests/next-word/driver.cxx @@ -0,0 +1,46 @@ +// file : tests/next-word/driver.cxx -*- C++ -*- +// license : MIT; see accompanying LICENSE file + +#include <vector> +#include <string> +//#include <iostream> + +#include <libbutl/utility.hxx> + +#undef NDEBUG +#include <cassert> + +using namespace std; +using namespace butl; + +using strings = vector<string>; + +static strings +parse_lines (const string& s) +{ + strings r; + for (size_t b (0), e (0), m (0), n (s.size ()); + next_word (s, n, b, e, m, '\n', '\r'), b != n; ) + { + //cerr << "'" << string (s, b, e - b) << "'" << endl; + r.push_back (string (s, b, e - b)); + } + return r; +} + +int +main () +{ + assert ((parse_lines("") == strings {})); + assert ((parse_lines("a") == strings {"a"})); + assert ((parse_lines("\n") == strings {"", ""})); + assert ((parse_lines("\n\n") == strings {"", "", ""})); + assert ((parse_lines("\n\n\n") == strings {"", "", "", ""})); + assert ((parse_lines("\na") == strings {"", "a"})); + assert ((parse_lines("\n\na") == strings {"", "", "a"})); + assert ((parse_lines("a\n") == strings {"a", ""})); + assert ((parse_lines("a\n\n") == strings {"a", "", ""})); + assert ((parse_lines("a\nb") == strings {"a", "b"})); + assert ((parse_lines("a\n\nb") == strings {"a", "", "b"})); + assert ((parse_lines("\na\nb\n") == strings {"", "a", "b", ""})); +} diff --git a/tests/odb/buildfile b/tests/odb/buildfile new file mode 100644 index 0000000..c59ab0f --- /dev/null +++ b/tests/odb/buildfile @@ -0,0 +1,6 @@ +# file : tests/odb/buildfile +# license : MIT; see accompanying LICENSE file + +import libs = libbutl%lib{butl-odb} + +exe{driver}: {hxx cxx}{*} $libs diff --git a/tests/odb/driver.cxx b/tests/odb/driver.cxx new file mode 120000 index 0000000..d880fda --- /dev/null +++ b/tests/odb/driver.cxx @@ -0,0 +1 @@ +../../upstream/odb/libodb-sqlite/tests/basics/driver.cxx
\ No newline at end of file diff --git a/tests/pkg-config/buildfile b/tests/pkg-config/buildfile new file mode 100644 index 0000000..896b916 --- /dev/null +++ b/tests/pkg-config/buildfile @@ -0,0 +1,6 @@ +# file : tests/pkg-config/buildfile +# license : MIT; see accompanying LICENSE file + +import libs = libbutl%lib{butl-pkg-config} + +exe{driver}: {h c}{*} $libs testscript diff --git a/tests/pkg-config/driver.c b/tests/pkg-config/driver.c new file mode 120000 index 0000000..2e6f14a --- /dev/null +++ b/tests/pkg-config/driver.c @@ -0,0 +1 @@ +../../upstream/libpkg-config/libpkg-config/tests/basic/driver.c
\ No newline at end of file diff --git a/tests/pkg-config/testscript b/tests/pkg-config/testscript new file mode 120000 index 0000000..628bd41 --- /dev/null +++ b/tests/pkg-config/testscript @@ -0,0 +1 @@ +../../upstream/libpkg-config/libpkg-config/tests/basic/testscript
\ No newline at end of file |