aboutsummaryrefslogtreecommitdiff
path: root/tests/build
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-06-18 12:25:02 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-06-18 12:25:02 +0200
commit4cda4b89c16932f02e04c5019a71b659ccf821e6 (patch)
tree8fbaddb1c64a53c9c871c1a96a99ec64490d222a /tests/build
parent5cb5b09b198932a0d3bd985fd52fd9fbcb1c2af5 (diff)
Move prefix-map from build2 to libbutl
Diffstat (limited to 'tests/build')
-rw-r--r--tests/build/buildfile2
-rw-r--r--tests/build/prefix-map/buildfile1
-rw-r--r--tests/build/prefix-map/driver.cxx153
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);
- }
- }
-}