Peter Collingbourne | 9d3d032 | 2014-03-06 04:11:10 +0000 | [diff] [blame] | 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 6 | // Source Licenses. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
Eric Fiselier | 5495e2e | 2015-02-10 17:20:18 +0000 | [diff] [blame] | 10 | // NOTE: Undefined __DEPRECATED to prevent this test from failing with -Werror |
| 11 | #undef __DEPRECATED |
Peter Collingbourne | 9d3d032 | 2014-03-06 04:11:10 +0000 | [diff] [blame] | 12 | #include <assert.h> |
| 13 | #include <ext/hash_map> |
| 14 | #include <string> |
| 15 | |
| 16 | int main() |
| 17 | { |
| 18 | char str[] = "test"; |
| 19 | assert(__gnu_cxx::hash<const char *>()("test") == |
| 20 | std::hash<std::string>()("test")); |
| 21 | assert(__gnu_cxx::hash<char *>()(str) == std::hash<std::string>()("test")); |
| 22 | assert(__gnu_cxx::hash<char>()(42) == 42); |
| 23 | assert(__gnu_cxx::hash<signed char>()(42) == 42); |
| 24 | assert(__gnu_cxx::hash<unsigned char>()(42) == 42); |
| 25 | assert(__gnu_cxx::hash<short>()(42) == 42); |
| 26 | assert(__gnu_cxx::hash<unsigned short>()(42) == 42); |
| 27 | assert(__gnu_cxx::hash<int>()(42) == 42); |
| 28 | assert(__gnu_cxx::hash<unsigned int>()(42) == 42); |
| 29 | assert(__gnu_cxx::hash<long>()(42) == 42); |
| 30 | assert(__gnu_cxx::hash<unsigned long>()(42) == 42); |
| 31 | } |