aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/common.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-30 13:04:20 -0500
committerJacek Antonelli2009-04-30 13:07:16 -0500
commitca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e (patch)
tree8348301d0ac44a524f1819b777686bf086907d76 /linden/indra/test/common.cpp
parentSecond Life viewer sources 1.22.11 (diff)
downloadmeta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.zip
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.gz
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.bz2
meta-impy-ca8149ca6d157eb4b5fc8ba0e5ba3a6e56f72e7e.tar.xz
Second Life viewer sources 1.23.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/test/common.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/linden/indra/test/common.cpp b/linden/indra/test/common.cpp
index ae84f18..c8e6268 100644
--- a/linden/indra/test/common.cpp
+++ b/linden/indra/test/common.cpp
@@ -19,7 +19,8 @@
19 * There are special exceptions to the terms and conditions of the GPL as 19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception 20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or 21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 * 24 *
24 * By copying, modifying or distributing this software, you acknowledge 25 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above, 26 * that you have read and understood your obligations described above,
@@ -48,6 +49,7 @@
48#include "llsd.h" 49#include "llsd.h"
49#include "llsdserialize.h" 50#include "llsdserialize.h"
50#include "u64.h" 51#include "u64.h"
52#include "llhash.h"
51 53
52#if LL_WINDOWS 54#if LL_WINDOWS
53// disable overflow warnings 55// disable overflow warnings
@@ -638,3 +640,36 @@ namespace tut
638} 640}
639 641
640 642
643namespace tut
644{
645 struct hash_data
646 {
647 };
648 typedef test_group<hash_data> hash_test;
649 typedef hash_test::object hash_object;
650 tut::hash_test hash_tester("hash_test");
651
652 template<> template<>
653 void hash_object::test<1>()
654 {
655 const char * str1 = "test string one";
656 const char * same_as_str1 = "test string one";
657
658 size_t hash1 = llhash(str1);
659 size_t same_as_hash1 = llhash(same_as_str1);
660
661
662 ensure("Hashes from identical strings should be equal", hash1 == same_as_hash1);
663
664 char str[100];
665 strcpy( str, "Another test" );
666
667 size_t hash2 = llhash(str);
668
669 strcpy( str, "Different string, same pointer" );
670
671 size_t hash3 = llhash(str);
672
673 ensure("Hashes from same pointer but different string should not be equal", hash2 != hash3);
674 }
675}