diff options
Diffstat (limited to 'tests/build')
-rw-r--r-- | tests/build/buildfile | 2 | ||||
-rw-r--r-- | tests/build/prefix-map/buildfile | 1 | ||||
-rw-r--r-- | tests/build/prefix-map/driver.cxx | 153 |
3 files changed, 1 insertions, 155 deletions
diff --git a/tests/build/buildfile b/tests/build/buildfile index 99a0a6f..19ea46e 100644 --- a/tests/build/buildfile +++ b/tests/build/buildfile @@ -1,4 +1,4 @@ -d=path/ prefix-map/ +d=path/ .: $d include $d diff --git a/tests/build/prefix-map/buildfile b/tests/build/prefix-map/buildfile deleted file mode 100644 index a72d02f..0000000 --- a/tests/build/prefix-map/buildfile +++ /dev/null @@ -1 +0,0 @@ -exe{driver}: cxx{driver} diff --git a/tests/build/prefix-map/driver.cxx b/tests/build/prefix-map/driver.cxx deleted file mode 100644 index bbbd472..0000000 --- a/tests/build/prefix-map/driver.cxx +++ /dev/null @@ -1,153 +0,0 @@ -// file : tests/build/prefix-map/driver.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include <string> -#include <cassert> -#include <iostream> - -#include <build/prefix-map> - -using namespace std; -using namespace build; - -int -main () -{ - typedef prefix_map<string, int, '.'> pm; - - { - const pm m; - - { - auto r (m.find_prefix ("")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("foo")); - assert (r.first == r.second); - } - } - - { - pm m {{{"foo", 1}}}; - - { - auto r (m.find_prefix ("")); - assert (r.first != r.second && r.first->second == 1 && - ++r.first == r.second); - } - - { - auto r (m.find_prefix ("fo")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("fox")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("fooo")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("foo.bar")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("foo")); - assert (r.first != r.second && r.first->second == 1 && - ++r.first == r.second); - } - } - - { - pm m {{{"foo", 1}, {"bar", 2}}}; - - { - auto r (m.find_prefix ("")); - assert (r.first != r.second && r.first->second == 2 && - ++r.first != r.second && r.first->second == 1 && - ++r.first == r.second); - } - - { - auto r (m.find_prefix ("fo")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("fox")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("fooo")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("foo.bar")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("foo")); - assert (r.first != r.second && r.first->second == 1 && - ++r.first == r.second); - } - - { - auto r (m.find_prefix ("bar")); - assert (r.first != r.second && r.first->second == 2 && - ++r.first == r.second); - } - } - - { - pm m ( - {{"boo", 1}, - {"foo", 2}, {"fooa", 3}, {"foo.bar", 4}, {"foo.fox", 5}, - {"xoo", 5}}); - - { - auto r (m.find_prefix ("fo")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("fox")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("fooo")); - assert (r.first == r.second); - } - - { - auto r (m.find_prefix ("foo.bar")); - assert (r.first != r.second && r.first->second == 4 && - ++r.first == r.second); - } - - { - auto r (m.find_prefix ("foo.fox")); - assert (r.first != r.second && r.first->second == 5 && - ++r.first == r.second); - } - - { - auto r (m.find_prefix ("foo")); - assert (r.first != r.second && r.first->second == 2 && - ++r.first != r.second && r.first->second == 4 && - ++r.first != r.second && r.first->second == 5 && - ++r.first == r.second); - } - } -} |