diff options
author | Alon Zakai <azakai@mozilla.com> | 2011-01-17 15:36:26 -0800 |
---|---|---|
committer | Alon Zakai <azakai@mozilla.com> | 2011-01-17 15:36:26 -0800 |
commit | 1f3de5c76e4947afccca350da24859e52f6aa83f (patch) | |
tree | 1539bbf09d9a3b71e06db5444d4ea5ceb43f8013 /tests/libcxx/main.cpp | |
parent | 13a520ed493d40e405045df1829863edfdb2308e (diff) |
libcxx test; support for linking in test runner; failure in clang_0_1.test_libcxx
Diffstat (limited to 'tests/libcxx/main.cpp')
-rw-r--r-- | tests/libcxx/main.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/libcxx/main.cpp b/tests/libcxx/main.cpp new file mode 100644 index 00000000..fefb6cc3 --- /dev/null +++ b/tests/libcxx/main.cpp @@ -0,0 +1,45 @@ +//#include <iostream> +#include <stdio.h> +#include <map> +#include <cstring> + +using namespace std; + +struct ltstr +{ + bool operator()(const char* s1, const char* s2) const + { + return strcmp(s1, s2) < 0; + } +}; + +int main() +{ + map<const char*, int, ltstr> months; + + months["january"] = 31; + months["february"] = 28; + months["march"] = 31; + months["april"] = 30; + months["may"] = 31; + months["june"] = 30; + months["july"] = 31; + months["august"] = 31; + months["september"] = 30; + months["october"] = 31; + months["november"] = 30; + months["december"] = 31; + + //cout << "june -> " << months["june"] << endl; + printf("june -> %d\n", months["june"]); + map<const char*, int, ltstr>::iterator cur = months.find("june"); + map<const char*, int, ltstr>::iterator prev = cur; + map<const char*, int, ltstr>::iterator next = cur; + ++next; + --prev; + //cout << "Previous (in alphabetical order) is " << (*prev).first << endl; + //cout << "Next (in alphabetical order) is " << (*next).first << endl; + printf("Previous (in alphabetical order) is %s\n", (*prev).first); + printf("Next (in alphabetical order) is %s\n", (*next).first); +} + |