aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test
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
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 'linden/indra/test')
-rw-r--r--linden/indra/test/CMakeLists.txt14
-rw-r--r--linden/indra/test/assembly_tut.cpp86
-rw-r--r--linden/indra/test/common.cpp37
-rw-r--r--linden/indra/test/inventory.cpp3
-rw-r--r--linden/indra/test/io.cpp3
-rw-r--r--linden/indra/test/llapp_tut.cpp5
-rw-r--r--linden/indra/test/llassetuploadqueue_tut.cpp3
-rw-r--r--linden/indra/test/llbase64_tut.cpp3
-rw-r--r--linden/indra/test/llbitpack_tut.cpp5
-rw-r--r--linden/indra/test/llblowfish_tut.cpp15
-rw-r--r--linden/indra/test/llbuffer_tut.cpp5
-rw-r--r--linden/indra/test/llcontrol_tut.cpp5
-rw-r--r--linden/indra/test/lldatapacker_tut.cpp5
-rw-r--r--linden/indra/test/lldate_tut.cpp5
-rw-r--r--linden/indra/test/lldir_tut.cpp5
-rw-r--r--linden/indra/test/llerror_tut.cpp5
-rw-r--r--linden/indra/test/llhost_tut.cpp5
-rw-r--r--linden/indra/test/llhttpclient_tut.cpp7
-rw-r--r--linden/indra/test/llhttpdate_tut.cpp3
-rw-r--r--linden/indra/test/llhttpnode_tut.cpp6
-rw-r--r--linden/indra/test/llinventoryparcel_tut.cpp3
-rw-r--r--linden/indra/test/lliohttpserver_tut.cpp3
-rw-r--r--linden/indra/test/lljoint_tut.cpp5
-rw-r--r--linden/indra/test/llmessageconfig_tut.cpp3
-rw-r--r--linden/indra/test/llmessagetemplateparser_tut.cpp3
-rw-r--r--linden/indra/test/llmime_tut.cpp5
-rw-r--r--linden/indra/test/llmodularmath_tut.cpp5
-rw-r--r--linden/indra/test/llnamevalue_tut.cpp3
-rw-r--r--linden/indra/test/llpartdata_tut.cpp5
-rw-r--r--linden/indra/test/llpermissions_tut.cpp5
-rw-r--r--linden/indra/test/llpipeutil.cpp3
-rw-r--r--linden/indra/test/llpipeutil.h3
-rw-r--r--linden/indra/test/llquaternion_tut.cpp5
-rw-r--r--linden/indra/test/llrandom_tut.cpp5
-rw-r--r--linden/indra/test/llsaleinfo_tut.cpp7
-rw-r--r--linden/indra/test/llscriptresource_tut.cpp204
-rw-r--r--linden/indra/test/llsd_new_tut.cpp5
-rwxr-xr-xlinden/indra/test/llsdmessagebuilder_tut.cpp561
-rwxr-xr-xlinden/indra/test/llsdmessagereader_tut.cpp5
-rw-r--r--linden/indra/test/llsdserialize_tut.cpp13
-rw-r--r--linden/indra/test/llsdtraits.h3
-rw-r--r--linden/indra/test/llsdutil_tut.cpp3
-rw-r--r--linden/indra/test/llservicebuilder_tut.cpp5
-rw-r--r--linden/indra/test/llstreamtools_tut.cpp5
-rw-r--r--linden/indra/test/llstring_tut.cpp13
-rw-r--r--linden/indra/test/lltemplatemessagebuilder_tut.cpp12
-rw-r--r--linden/indra/test/lltimestampcache_tut.cpp130
-rw-r--r--linden/indra/test/lltiming_tut.cpp3
-rw-r--r--linden/indra/test/lltranscode_tut.cpp95
-rw-r--r--linden/indra/test/lltut.cpp17
-rw-r--r--linden/indra/test/lltut.h15
-rw-r--r--linden/indra/test/lluri_tut.cpp3
-rw-r--r--linden/indra/test/lluserrelations_tut.cpp5
-rw-r--r--linden/indra/test/lluuidhashmap_tut.cpp5
-rw-r--r--linden/indra/test/llxfer_tut.cpp3
-rw-r--r--linden/indra/test/llxorcipher_tut.cpp3
-rw-r--r--linden/indra/test/m3math_tut.cpp5
-rw-r--r--linden/indra/test/mass_properties_tut.cpp25
-rw-r--r--linden/indra/test/math.cpp3
-rw-r--r--linden/indra/test/message_tut.cpp14
-rw-r--r--linden/indra/test/mock_http_client.cpp3
-rw-r--r--linden/indra/test/mock_http_client.h3
-rw-r--r--linden/indra/test/prim_linkability_tut.cpp25
-rw-r--r--linden/indra/test/reflection_tut.cpp5
-rw-r--r--linden/indra/test/test.cpp34
-rw-r--r--linden/indra/test/test.h50
-rw-r--r--linden/indra/test/test_llmanifest.py3
-rw-r--r--linden/indra/test/v2math_tut.cpp5
-rw-r--r--linden/indra/test/v3color_tut.cpp7
-rw-r--r--linden/indra/test/v3dmath_tut.cpp7
-rw-r--r--linden/indra/test/v3math_tut.cpp5
-rw-r--r--linden/indra/test/v4color_tut.cpp5
-rw-r--r--linden/indra/test/v4coloru_tut.cpp5
-rw-r--r--linden/indra/test/v4math_tut.cpp5
-rw-r--r--linden/indra/test/xform_tut.cpp5
75 files changed, 1338 insertions, 272 deletions
diff --git a/linden/indra/test/CMakeLists.txt b/linden/indra/test/CMakeLists.txt
index acb571b..2033d67 100644
--- a/linden/indra/test/CMakeLists.txt
+++ b/linden/indra/test/CMakeLists.txt
@@ -10,7 +10,9 @@ include(LLMath)
10include(LLMessage) 10include(LLMessage)
11include(LLVFS) 11include(LLVFS)
12include(LLXML) 12include(LLXML)
13include(LScript)
13include(Linking) 14include(Linking)
15include(Tut)
14 16
15include_directories( 17include_directories(
16 ${LLCOMMON_INCLUDE_DIRS} 18 ${LLCOMMON_INCLUDE_DIRS}
@@ -20,13 +22,14 @@ include_directories(
20 ${LLINVENTORY_INCLUDE_DIRS} 22 ${LLINVENTORY_INCLUDE_DIRS}
21 ${LLVFS_INCLUDE_DIRS} 23 ${LLVFS_INCLUDE_DIRS}
22 ${LLXML_INCLUDE_DIRS} 24 ${LLXML_INCLUDE_DIRS}
25 ${LSCRIPT_INCLUDE_DIRS}
23 ) 26 )
24 27
25set(test_SOURCE_FILES 28set(test_SOURCE_FILES
26 common.cpp 29 common.cpp
27 inventory.cpp 30 inventory.cpp
28 io.cpp 31 io.cpp
29 llapp_tut.cpp 32# llapp_tut.cpp # Temporarily removed until thread issues can be solved
30 llbase64_tut.cpp 33 llbase64_tut.cpp
31 llblowfish_tut.cpp 34 llblowfish_tut.cpp
32 llbuffer_tut.cpp 35 llbuffer_tut.cpp
@@ -48,6 +51,7 @@ set(test_SOURCE_FILES
48 llquaternion_tut.cpp 51 llquaternion_tut.cpp
49 llrandom_tut.cpp 52 llrandom_tut.cpp
50 llsaleinfo_tut.cpp 53 llsaleinfo_tut.cpp
54 llscriptresource_tut.cpp
51 llsdmessagebuilder_tut.cpp 55 llsdmessagebuilder_tut.cpp
52 llsdmessagereader_tut.cpp 56 llsdmessagereader_tut.cpp
53 llsd_new_tut.cpp 57 llsd_new_tut.cpp
@@ -57,7 +61,9 @@ set(test_SOURCE_FILES
57 llstreamtools_tut.cpp 61 llstreamtools_tut.cpp
58 llstring_tut.cpp 62 llstring_tut.cpp
59 lltemplatemessagebuilder_tut.cpp 63 lltemplatemessagebuilder_tut.cpp
64 lltimestampcache_tut.cpp
60 lltiming_tut.cpp 65 lltiming_tut.cpp
66 lltranscode_tut.cpp
61 lltut.cpp 67 lltut.cpp
62 lluri_tut.cpp 68 lluri_tut.cpp
63 lluuidhashmap_tut.cpp 69 lluuidhashmap_tut.cpp
@@ -108,7 +114,9 @@ target_link_libraries(test
108 ${LLMATH_LIBRARIES} 114 ${LLMATH_LIBRARIES}
109 ${LLVFS_LIBRARIES} 115 ${LLVFS_LIBRARIES}
110 ${LLXML_LIBRARIES} 116 ${LLXML_LIBRARIES}
117 ${LSCRIPT_LIBRARIES}
111 ${LLCOMMON_LIBRARIES} 118 ${LLCOMMON_LIBRARIES}
119 ${APRICONV_LIBRARIES}
112 ${PTHREAD_LIBRARY} 120 ${PTHREAD_LIBRARY}
113 ${WINDOWS_LIBRARIES} 121 ${WINDOWS_LIBRARIES}
114 ${DL_LIBRARY} 122 ${DL_LIBRARY}
@@ -117,8 +125,8 @@ target_link_libraries(test
117if (WINDOWS) 125if (WINDOWS)
118 set_target_properties(test 126 set_target_properties(test
119 PROPERTIES 127 PROPERTIES
120 LINK_FLAGS "/NODEFAULTLIB:MSVCRT" 128 LINK_FLAGS "/NODEFAULTLIB:LIBCMT"
121 LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT" 129 LINK_FLAGS_DEBUG "/NODEFAULTLIB:\"LIBCMT;LIBCMTD;MSVCRT\""
122 ) 130 )
123endif (WINDOWS) 131endif (WINDOWS)
124 132
diff --git a/linden/indra/test/assembly_tut.cpp b/linden/indra/test/assembly_tut.cpp
deleted file mode 100644
index 82a2b03..0000000
--- a/linden/indra/test/assembly_tut.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
1/**
2 * @file assembly_tut.cpp
3 * @brief Tests for lscript/lscript_execute_mono
4 *
5 * $LicenseInfo:firstyear=2007&license=internal$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of
10 * this source code is governed by the Linden Lab Source Code Disclosure
11 * Agreement ("Agreement") previously entered between you and Linden
12 * Lab. By accessing, using, copying, modifying or distributing this
13 * software, you acknowledge that you have been informed of your
14 * obligations under the Agreement and agree to abide by those obligations.
15 *
16 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
17 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
18 * COMPLETENESS OR PERFORMANCE.
19 * $/LicenseInfo$
20 */
21
22#include "linden_common.h"
23#include "lltut.h"
24
25#include "lscript_execute_mono/assembly.cpp"
26
27#include <string>
28#include <map>
29
30
31namespace tut
32{
33 struct assembly_data
34 {
35 };
36 typedef test_group<assembly_data> assembly_test;
37 typedef assembly_test::object assembly_object;
38 tut::assembly_test assembly("assembly");
39
40 // Create some random junk, its not important at the moment.
41 U8* createTestBuffer(U32 size)
42 {
43 U8* result = new U8[size];
44 memset(result, 0, size);
45 return result;
46 }
47
48 template<> template<>
49 void assembly_object::test<1>()
50 {
51 ensure("Assembly map not empty before creation", sAssemblyMap.empty());
52 {
53 U32 size = 10;
54 U8* buffer = createTestBuffer(size);
55 boost::intrusive_ptr<LLAssembly> assembly1 = LLAssembly::create("Assembly1",
56 buffer, size);
57
58 ensure("created assembly with ref count of 1",
59 assembly1->mRefCount == 1);
60
61 ensure("sAssemblyMap.size() == 1", sAssemblyMap.size() == 1);
62
63 size = 200;
64 buffer = createTestBuffer(size);
65 boost::intrusive_ptr<LLAssembly> assembly2 = LLAssembly::create("Assembly2",
66 buffer, size);
67
68 ensure("created second assembly with ref count == 1",
69 assembly2->mRefCount == 1);
70
71 ensure("sAssemblyMap.size() == 2", sAssemblyMap.size() == 2);
72
73 size = 10;
74 buffer = createTestBuffer(size);
75 boost::intrusive_ptr<LLAssembly> assembly3 = LLAssembly::create("Assembly1",
76 buffer, size);
77
78 ensure("created with ref count of 2",
79 assembly3->mRefCount == 2);
80
81 ensure("sAssemblyMap.size() == 2", sAssemblyMap.size() == 2);
82 }
83
84 ensure("Assembly map not empty after creation", sAssemblyMap.empty());
85 }
86}
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}
diff --git a/linden/indra/test/inventory.cpp b/linden/indra/test/inventory.cpp
index 64d7bff..8cd356b 100644
--- a/linden/indra/test/inventory.cpp
+++ b/linden/indra/test/inventory.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,
diff --git a/linden/indra/test/io.cpp b/linden/indra/test/io.cpp
index fe161c5..483eb9d 100644
--- a/linden/indra/test/io.cpp
+++ b/linden/indra/test/io.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,
diff --git a/linden/indra/test/llapp_tut.cpp b/linden/indra/test/llapp_tut.cpp
index 8453e50..3f5ac38 100644
--- a/linden/indra/test/llapp_tut.cpp
+++ b/linden/indra/test/llapp_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34 35
35#include "linden_common.h" 36#include "linden_common.h"
36#include "llapp.h" 37#include "llapp.h"
diff --git a/linden/indra/test/llassetuploadqueue_tut.cpp b/linden/indra/test/llassetuploadqueue_tut.cpp
index 8ece4a5..241574e 100644
--- a/linden/indra/test/llassetuploadqueue_tut.cpp
+++ b/linden/indra/test/llassetuploadqueue_tut.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llbase64_tut.cpp b/linden/indra/test/llbase64_tut.cpp
index 898c68b..8598986 100644
--- a/linden/indra/test/llbase64_tut.cpp
+++ b/linden/indra/test/llbase64_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llbitpack_tut.cpp b/linden/indra/test/llbitpack_tut.cpp
index 92782ab..be1dcb2 100644
--- a/linden/indra/test/llbitpack_tut.cpp
+++ b/linden/indra/test/llbitpack_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "bitpack.h" 37#include "bitpack.h"
37#include "lltut.h" 38#include "lltut.h"
diff --git a/linden/indra/test/llblowfish_tut.cpp b/linden/indra/test/llblowfish_tut.cpp
index e1386fa..4a128a8 100644
--- a/linden/indra/test/llblowfish_tut.cpp
+++ b/linden/indra/test/llblowfish_tut.cpp
@@ -22,7 +22,8 @@
22 * There are special exceptions to the terms and conditions of the GPL as 22 * There are special exceptions to the terms and conditions of the GPL as
23 * it is applied to this Source Code. View the full text of the exception 23 * it is applied to this Source Code. View the full text of the exception
24 * in the file doc/FLOSS-exception.txt in this software distribution, or 24 * in the file doc/FLOSS-exception.txt in this software distribution, or
25 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 25 * online at
26 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
26 * 27 *
27 * By copying, modifying or distributing this software, you acknowledge 28 * By copying, modifying or distributing this software, you acknowledge
28 * that you have read and understood your obligations described above, 29 * that you have read and understood your obligations described above,
@@ -93,9 +94,6 @@ namespace tut
93 template<> template<> 94 template<> template<>
94 void blowfish_object::test<1>() 95 void blowfish_object::test<1>()
95 { 96 {
96#if LL_WINDOWS
97 skip_fail("Blowfish only supported on Linux.");
98#else
99 LLUUID blank; 97 LLUUID blank;
100 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); 98 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES);
101 99
@@ -108,15 +106,11 @@ namespace tut
108 dst_len = cipher.requiredEncryptionSpace(8); 106 dst_len = cipher.requiredEncryptionSpace(8);
109 ensure("encryption space 8", 107 ensure("encryption space 8",
110 (dst_len == 16) ); 108 (dst_len == 16) );
111#endif // LL_WINDOWS
112 } 109 }
113 110
114 template<> template<> 111 template<> template<>
115 void blowfish_object::test<2>() 112 void blowfish_object::test<2>()
116 { 113 {
117#if LL_WINDOWS
118 skip_fail("Blowfish only supported on Linux.");
119#else
120 LLUUID blank; 114 LLUUID blank;
121 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES); 115 LLBlowfishCipher cipher(&blank.mData[0], UUID_BYTES);
122 116
@@ -130,15 +124,11 @@ namespace tut
130 result.resize(count); 124 result.resize(count);
131 125
132 ensure("encrypt null key", matchFile("blowfish.1.bin", result)); 126 ensure("encrypt null key", matchFile("blowfish.1.bin", result));
133#endif // LL_WINDOWS
134 } 127 }
135 128
136 template<> template<> 129 template<> template<>
137 void blowfish_object::test<3>() 130 void blowfish_object::test<3>()
138 { 131 {
139#if LL_WINDOWS
140 skip_fail("Blowfish only supported on Linux.");
141#else
142 // same as base64 test id 132 // same as base64 test id
143 LLUUID id("526a1e07-a19d-baed-84c4-ff08a488d15e"); 133 LLUUID id("526a1e07-a19d-baed-84c4-ff08a488d15e");
144 LLBlowfishCipher cipher(&id.mData[0], UUID_BYTES); 134 LLBlowfishCipher cipher(&id.mData[0], UUID_BYTES);
@@ -153,6 +143,5 @@ namespace tut
153 result.resize(count); 143 result.resize(count);
154 144
155 ensure("encrypt real key", matchFile("blowfish.2.bin", result)); 145 ensure("encrypt real key", matchFile("blowfish.2.bin", result));
156#endif // LL_WINDOWS
157 } 146 }
158} 147}
diff --git a/linden/indra/test/llbuffer_tut.cpp b/linden/indra/test/llbuffer_tut.cpp
index 46708ce..a0b6379 100644
--- a/linden/indra/test/llbuffer_tut.cpp
+++ b/linden/indra/test/llbuffer_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "llbuffer.h" 38#include "llbuffer.h"
diff --git a/linden/indra/test/llcontrol_tut.cpp b/linden/indra/test/llcontrol_tut.cpp
index 68e8a92..2e2c1dd 100644
--- a/linden/indra/test/llcontrol_tut.cpp
+++ b/linden/indra/test/llcontrol_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -32,7 +33,7 @@
32 33
33#include "linden_common.h" 34#include "linden_common.h"
34 35
35#include <tut/tut.h> 36#include <tut/tut.hpp>
36#include "lltut.h" 37#include "lltut.h"
37 38
38#include "llcontrol.h" 39#include "llcontrol.h"
diff --git a/linden/indra/test/lldatapacker_tut.cpp b/linden/indra/test/lldatapacker_tut.cpp
index dd424af..6c0fa56 100644
--- a/linden/indra/test/lldatapacker_tut.cpp
+++ b/linden/indra/test/lldatapacker_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "lltut.h" 36#include "lltut.h"
36#include "linden_common.h" 37#include "linden_common.h"
37#include "lldatapacker.h" 38#include "lldatapacker.h"
diff --git a/linden/indra/test/lldate_tut.cpp b/linden/indra/test/lldate_tut.cpp
index 5a0fb96..630d34e 100644
--- a/linden/indra/test/lldate_tut.cpp
+++ b/linden/indra/test/lldate_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lldate.h" 37#include "lldate.h"
37 38
diff --git a/linden/indra/test/lldir_tut.cpp b/linden/indra/test/lldir_tut.cpp
index 4d9be65..2b0dde0 100644
--- a/linden/indra/test/lldir_tut.cpp
+++ b/linden/indra/test/lldir_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34#include "linden_common.h" 35#include "linden_common.h"
35#include "lltut.h" 36#include "lltut.h"
36 37
diff --git a/linden/indra/test/llerror_tut.cpp b/linden/indra/test/llerror_tut.cpp
index d6a4c07..c4f52f6 100644
--- a/linden/indra/test/llerror_tut.cpp
+++ b/linden/indra/test/llerror_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -41,7 +42,7 @@ namespace
41 } 42 }
42} 43}
43 44
44#include <tut/tut.h> 45#include <tut/tut.hpp>
45#include "lltut.h" 46#include "lltut.h"
46 47
47#include <vector> 48#include <vector>
diff --git a/linden/indra/test/llhost_tut.cpp b/linden/indra/test/llhost_tut.cpp
index c9e7c3b..dd792d9 100644
--- a/linden/indra/test/llhost_tut.cpp
+++ b/linden/indra/test/llhost_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "llhost.h" 38#include "llhost.h"
diff --git a/linden/indra/test/llhttpclient_tut.cpp b/linden/indra/test/llhttpclient_tut.cpp
index 7f3b646..d1bf8ae 100644
--- a/linden/indra/test/llhttpclient_tut.cpp
+++ b/linden/indra/test/llhttpclient_tut.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -35,7 +36,7 @@
35 * 36 *
36 */ 37 */
37 38
38#include <tut/tut.h> 39#include <tut/tut.hpp>
39#include "linden_common.h" 40#include "linden_common.h"
40 41
41// These are too slow on Windows to actually include in the build. JC 42// These are too slow on Windows to actually include in the build. JC
@@ -345,7 +346,7 @@ namespace tut
345 // won't ever let it run. Instead get from a known LLSD 346 // won't ever let it run. Instead get from a known LLSD
346 // source and compare results with the non-blocking get which 347 // source and compare results with the non-blocking get which
347 // is tested against the mini server earlier. 348 // is tested against the mini server earlier.
348 skip_fail("secondlife.com is not reliable enough for unit tests."); 349 skip("secondlife.com is not reliable enough for unit tests.");
349 350
350 351
351 LLSD expected; 352 LLSD expected;
diff --git a/linden/indra/test/llhttpdate_tut.cpp b/linden/indra/test/llhttpdate_tut.cpp
index 76a39c6..b764696 100644
--- a/linden/indra/test/llhttpdate_tut.cpp
+++ b/linden/indra/test/llhttpdate_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llhttpnode_tut.cpp b/linden/indra/test/llhttpnode_tut.cpp
index 04be854..e17d1e0 100644
--- a/linden/indra/test/llhttpnode_tut.cpp
+++ b/linden/indra/test/llhttpnode_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -85,7 +86,8 @@ namespace tut
85 86
86 void result(const LLSD& result) { mResult = result; } 87 void result(const LLSD& result) { mResult = result; }
87 void status(S32 code, const std::string& message) { } 88 void status(S32 code, const std::string& message) { }
88 89 void extendedResult(S32 code, const std::string& message, const LLSD& headers) { }
90
89 private: 91 private:
90 Response() {;} // Must be accessed through LLPointer. 92 Response() {;} // Must be accessed through LLPointer.
91 }; 93 };
diff --git a/linden/indra/test/llinventoryparcel_tut.cpp b/linden/indra/test/llinventoryparcel_tut.cpp
index 9c5c54c..63669e8 100644
--- a/linden/indra/test/llinventoryparcel_tut.cpp
+++ b/linden/indra/test/llinventoryparcel_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/lliohttpserver_tut.cpp b/linden/indra/test/lliohttpserver_tut.cpp
index ca0c211..7d3b312 100644
--- a/linden/indra/test/lliohttpserver_tut.cpp
+++ b/linden/indra/test/lliohttpserver_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/lljoint_tut.cpp b/linden/indra/test/lljoint_tut.cpp
index 45b4cc7..a84d2b6 100644
--- a/linden/indra/test/lljoint_tut.cpp
+++ b/linden/indra/test/lljoint_tut.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,
@@ -34,7 +35,7 @@
34#ifdef THIS_DOESNT_LINK 35#ifdef THIS_DOESNT_LINK
35// THIS DOESN'T LINK! 36// THIS DOESN'T LINK!
36 37
37#include <tut/tut.h> 38#include <tut/tut.hpp>
38#include "lltut.h" 39#include "lltut.h"
39#include "linden_common.h" 40#include "linden_common.h"
40#include "m4math.h" 41#include "m4math.h"
diff --git a/linden/indra/test/llmessageconfig_tut.cpp b/linden/indra/test/llmessageconfig_tut.cpp
index c4b506d..ddc1d07 100644
--- a/linden/indra/test/llmessageconfig_tut.cpp
+++ b/linden/indra/test/llmessageconfig_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llmessagetemplateparser_tut.cpp b/linden/indra/test/llmessagetemplateparser_tut.cpp
index 7158c8a..02acc15 100644
--- a/linden/indra/test/llmessagetemplateparser_tut.cpp
+++ b/linden/indra/test/llmessagetemplateparser_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llmime_tut.cpp b/linden/indra/test/llmime_tut.cpp
index c2185e3..ab87731 100644
--- a/linden/indra/test/llmime_tut.cpp
+++ b/linden/indra/test/llmime_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "llmime.h" 37#include "llmime.h"
37#include "llsdserialize.h" 38#include "llsdserialize.h"
diff --git a/linden/indra/test/llmodularmath_tut.cpp b/linden/indra/test/llmodularmath_tut.cpp
index 32bcbe0..519e045 100644
--- a/linden/indra/test/llmodularmath_tut.cpp
+++ b/linden/indra/test/llmodularmath_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "llmodularmath.h" 38#include "llmodularmath.h"
diff --git a/linden/indra/test/llnamevalue_tut.cpp b/linden/indra/test/llnamevalue_tut.cpp
index 72e4571..2a7ca0c 100644
--- a/linden/indra/test/llnamevalue_tut.cpp
+++ b/linden/indra/test/llnamevalue_tut.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,
diff --git a/linden/indra/test/llpartdata_tut.cpp b/linden/indra/test/llpartdata_tut.cpp
index ffd26ac..cb31b81 100644
--- a/linden/indra/test/llpartdata_tut.cpp
+++ b/linden/indra/test/llpartdata_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "lltut.h" 36#include "lltut.h"
36#include "linden_common.h" 37#include "linden_common.h"
37#include "lldatapacker.h" 38#include "lldatapacker.h"
diff --git a/linden/indra/test/llpermissions_tut.cpp b/linden/indra/test/llpermissions_tut.cpp
index 10af319..9dbb964 100644
--- a/linden/indra/test/llpermissions_tut.cpp
+++ b/linden/indra/test/llpermissions_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "message.h" 38#include "message.h"
diff --git a/linden/indra/test/llpipeutil.cpp b/linden/indra/test/llpipeutil.cpp
index 32084a2..9c81fa3 100644
--- a/linden/indra/test/llpipeutil.cpp
+++ b/linden/indra/test/llpipeutil.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llpipeutil.h b/linden/indra/test/llpipeutil.h
index 49aaac4..acff2d8 100644
--- a/linden/indra/test/llpipeutil.h
+++ b/linden/indra/test/llpipeutil.h
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llquaternion_tut.cpp b/linden/indra/test/llquaternion_tut.cpp
index 0223749..b5b1047 100644
--- a/linden/indra/test/llquaternion_tut.cpp
+++ b/linden/indra/test/llquaternion_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35 36
36#include "linden_common.h" 37#include "linden_common.h"
37#include "lltut.h" 38#include "lltut.h"
diff --git a/linden/indra/test/llrandom_tut.cpp b/linden/indra/test/llrandom_tut.cpp
index c1c45b0..0a5d595 100644
--- a/linden/indra/test/llrandom_tut.cpp
+++ b/linden/indra/test/llrandom_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34 35
35#include "linden_common.h" 36#include "linden_common.h"
36#include "llrand.h" 37#include "llrand.h"
diff --git a/linden/indra/test/llsaleinfo_tut.cpp b/linden/indra/test/llsaleinfo_tut.cpp
index d91bca4..7f8219c 100644
--- a/linden/indra/test/llsaleinfo_tut.cpp
+++ b/linden/indra/test/llsaleinfo_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "llsaleinfo.h" 38#include "llsaleinfo.h"
@@ -53,7 +54,7 @@ namespace tut
53 54
54 S32 sale_price = 10000; 55 S32 sale_price = 10000;
55 LLSaleInfo llsaleinfo(LLSaleInfo::FS_COPY, sale_price); 56 LLSaleInfo llsaleinfo(LLSaleInfo::FS_COPY, sale_price);
56 char* sale= "copy"; 57 const char* sale= "copy";
57 58
58 LLSD llsd_obj1 = ll_create_sd_from_sale_info(llsaleinfo); 59 LLSD llsd_obj1 = ll_create_sd_from_sale_info(llsaleinfo);
59 LLSaleInfo saleinfo1 = ll_sale_info_from_sd(llsd_obj1); 60 LLSaleInfo saleinfo1 = ll_sale_info_from_sd(llsd_obj1);
diff --git a/linden/indra/test/llscriptresource_tut.cpp b/linden/indra/test/llscriptresource_tut.cpp
new file mode 100644
index 0000000..705fdd1
--- /dev/null
+++ b/linden/indra/test/llscriptresource_tut.cpp
@@ -0,0 +1,204 @@
1/**
2 * @file llscriptresource_tut.cpp
3 * @brief Test LLScriptResource
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33//#include <tut/tut.h>
34#include "linden_common.h"
35
36#include "lltut.h"
37
38#include "llscriptresource.h"
39#include "llscriptresourceconsumer.h"
40#include "llscriptresourcepool.h"
41
42class TestConsumer : public LLScriptResourceConsumer
43{
44public:
45 TestConsumer()
46 : mUsedURLs(0)
47 { }
48
49 // LLScriptResourceConsumer interface:
50 S32 getUsedPublicURLs() const
51 {
52 return mUsedURLs;
53 }
54
55 // Test details:
56 S32 mUsedURLs;
57};
58
59
60namespace tut
61{
62 class LLScriptResourceTestData
63 {
64 };
65
66 typedef test_group<LLScriptResourceTestData> LLScriptResourceTestGroup;
67 typedef LLScriptResourceTestGroup::object LLScriptResourceTestObject;
68 LLScriptResourceTestGroup scriptResourceTestGroup("scriptResource");
69
70 template<> template<>
71 void LLScriptResourceTestObject::test<1>()
72 {
73 LLScriptResource resource;
74 U32 total = 42;
75
76 resource.setTotal(total);
77 ensure_equals("Verify set/get total", resource.getTotal(), total);
78 ensure_equals("Verify all resources are initially available",resource.getAvailable(),total);
79
80 // Requesting too many, releasing non-allocated
81 ensure("Request total + 1 resources should fail",!resource.request(total + 1));
82 ensure_equals("Verify all resources available after failed request",resource.getAvailable(),total);
83
84 ensure("Releasing resources when none allocated should fail",!resource.release());
85 ensure_equals("All resources should be available after failed release",resource.getAvailable(),total);
86
87 ensure("Request one resource", resource.request());
88 ensure_equals("Verify available resources after successful request",resource.getAvailable(),total - 1);
89
90 // Is this right? Or should we release all used resources if we try to release more than are currently used?
91 ensure("Release more resources than allocated",!resource.release(2));
92 ensure_equals("Verify resource availability after failed release",resource.getAvailable(),total - 1);
93
94 ensure("Release a resource",resource.release());
95 ensure_equals("Verify all resources available after successful release",resource.getAvailable(),total);
96 }
97
98
99 template<> template<>
100 void LLScriptResourceTestObject::test<2>()
101 {
102 LLScriptResource resource;
103 U32 total = 42;
104
105 resource.setTotal(total);
106
107 S32 resources_to_request = 30;
108 ensure("Get multiple resources resources",resource.request(resources_to_request));
109 ensure_equals("Verify available resources is correct after request of multiple resources",resource.getAvailable(), total - resources_to_request);
110
111 S32 resources_to_release = (resources_to_request / 2);
112 ensure("Release some resources",resource.release(resources_to_release));
113
114 S32 expected_available = (total - resources_to_request + resources_to_release);
115 ensure_equals("Verify available resources after release of some resources",resource.getAvailable(), expected_available);
116
117 resources_to_release = (resources_to_request - resources_to_release);
118 ensure("Release remaining resources",resource.release(resources_to_release));
119
120 ensure_equals("Verify available resources after release of remaining resources",resource.getAvailable(), total);
121 }
122
123 template<> template<>
124 void LLScriptResourceTestObject::test<3>()
125 {
126 LLScriptResource resource;
127
128 U32 total = 42;
129 resource.setTotal(total);
130
131 ensure("Request all resources",resource.request(total));
132
133 U32 low_total = 10;
134 ensure("Release all resources",resource.release(total));
135 ensure_equals("Verify all resources available after releasing",resource.getAvailable(),total);
136
137 resource.setTotal(low_total);
138 ensure_equals("Verify low total resources are available after set",resource.getAvailable(),low_total);
139 }
140
141
142 template<> template<>
143 void LLScriptResourceTestObject::test<4>()
144 {
145 S32 big_resource_total = 100;
146 S32 small_resource_total = 10;
147 LLScriptResourcePool big_pool;
148 big_pool.getPublicURLResource().setTotal(big_resource_total);
149 LLScriptResourcePool small_pool;
150 small_pool.getPublicURLResource().setTotal(small_resource_total);
151
152 TestConsumer consumer;
153 LLScriptResourcePool& initial_pool = consumer.getScriptResourcePool();
154 ensure("Initial resource pool is 'null'.", (&initial_pool == &LLScriptResourcePool::null));
155
156 consumer.switchScriptResourcePools(big_pool);
157 LLScriptResourcePool& get_pool = consumer.getScriptResourcePool();
158 ensure("Get resource that was set.", (&big_pool == &get_pool));
159
160 ensure_equals("No public urls in use yet.", consumer.getUsedPublicURLs(),0);
161
162 S32 request_urls = 5;
163 consumer.mUsedURLs = request_urls;
164 consumer.getScriptResourcePool().getPublicURLResource().request(request_urls);
165
166 ensure_equals("Available urls on big_pool is 5 less than total.",
167 big_pool.getPublicURLResource().getAvailable(), big_resource_total - request_urls);
168
169 ensure("Switching from big pool to small pool",
170 consumer.switchScriptResourcePools(small_pool));
171
172 ensure_equals("All resources available to big pool again",
173 big_pool.getPublicURLResource().getAvailable(), big_resource_total);
174
175 ensure_equals("Available urls on small pool is 5 less than total.",
176 small_pool.getPublicURLResource().getAvailable(), small_resource_total - request_urls);
177
178 ensure("Switching from small pool to big pool",
179 consumer.switchScriptResourcePools(big_pool));
180
181 consumer.getScriptResourcePool().getPublicURLResource().release(request_urls);
182
183 request_urls = 50; // Too many for the small_pool
184
185 consumer.mUsedURLs = request_urls;
186 consumer.getScriptResourcePool().getPublicURLResource().request(request_urls);
187
188 // Verify big pool has them
189 ensure_equals("Available urls on big pool is 50 less than total.",
190 big_pool.getPublicURLResource().getAvailable(), big_resource_total - request_urls);
191
192 // Verify can't switch to small_pool
193 ensure("Switching to small pool with too many resources",
194 !consumer.switchScriptResourcePools(small_pool));
195
196 // Verify big pool still accounting for used resources
197 ensure_equals("Available urls on big_pool is still 50 less than total.",
198 big_pool.getPublicURLResource().getAvailable(), big_resource_total - request_urls);
199
200 // Verify small pool still has all resources available.
201 ensure_equals("All resources in small pool are still available.",
202 small_pool.getPublicURLResource().getAvailable(), small_resource_total);
203 }
204}
diff --git a/linden/indra/test/llsd_new_tut.cpp b/linden/indra/test/llsd_new_tut.cpp
index 7332d97..d73a0a3 100644
--- a/linden/indra/test/llsd_new_tut.cpp
+++ b/linden/indra/test/llsd_new_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34#include "linden_common.h" 35#include "linden_common.h"
35#include "lltut.h" 36#include "lltut.h"
36 37
diff --git a/linden/indra/test/llsdmessagebuilder_tut.cpp b/linden/indra/test/llsdmessagebuilder_tut.cpp
index 81a5b96..27ab127 100755
--- a/linden/indra/test/llsdmessagebuilder_tut.cpp
+++ b/linden/indra/test/llsdmessagebuilder_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,10 +31,11 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34 35
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
38#include "llmessagetemplate.h"
37#include "llsdmessagebuilder.h" 39#include "llsdmessagebuilder.h"
38#include "llsdmessagereader.h" 40#include "llsdmessagereader.h"
39#include "llsdtraits.h" 41#include "llsdtraits.h"
@@ -42,10 +44,24 @@
42#include "v3dmath.h" 44#include "v3dmath.h"
43#include "v3math.h" 45#include "v3math.h"
44#include "v4math.h" 46#include "v4math.h"
47#include "llsdutil_math.cpp"
48#include "lltemplatemessagebuilder.h"
45 49
46namespace tut 50namespace tut
47{ 51{
52 static LLTemplateMessageBuilder::message_template_name_map_t templateNameMap;
53
54 LLMsgData* messageData = NULL;
55 LLMsgBlkData* messageBlockData = NULL;
56
48 struct LLSDMessageBuilderTestData { 57 struct LLSDMessageBuilderTestData {
58
59 LLSDMessageBuilderTestData()
60 {
61 messageData = new LLMsgData("testMessage");
62 messageBlockData = new LLMsgBlkData("testBlock", 0);
63 }
64
49 static LLSDMessageBuilder defaultBuilder() 65 static LLSDMessageBuilder defaultBuilder()
50 { 66 {
51 LLSDMessageBuilder builder; 67 LLSDMessageBuilder builder;
@@ -60,6 +76,43 @@ namespace tut
60 reader.setMessage("name", builder.getMessage()); 76 reader.setMessage("name", builder.getMessage());
61 return reader; 77 return reader;
62 } 78 }
79
80 static void addValue(LLMsgBlkData* mbd, char* name, void* v, EMsgVariableType type, int size, int data_size = -1)
81 {
82 LLMsgVarData tmp(name, type);
83 tmp.addData(v, size, type, data_size);
84 mbd->mMemberVarData[name] = tmp;
85 }
86
87
88 static LLMessageBlock* defaultTemplateBlock(const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE)
89 {
90 return createTemplateBlock(_PREHASH_Test0, type, size, block);
91 }
92
93 static LLMessageBlock* createTemplateBlock(char* name, const EMsgVariableType type = MVT_NULL, const S32 size = 0, EMsgBlockType block = MBT_VARIABLE)
94 {
95 LLMessageBlock* result = new LLMessageBlock(name, block);
96 if(type != MVT_NULL)
97 {
98 result->addVariable(_PREHASH_Test0, type, size);
99 }
100 return result;
101 }
102
103 static LLTemplateMessageBuilder* defaultTemplateBuilder(LLMessageTemplate& messageTemplate, char* name = _PREHASH_Test0)
104 {
105 templateNameMap[_PREHASH_TestMessage] = &messageTemplate;
106 LLTemplateMessageBuilder* builder = new LLTemplateMessageBuilder(templateNameMap);
107 builder->newMessage(_PREHASH_TestMessage);
108 builder->nextBlock(name);
109 return builder;
110 }
111
112 static LLMessageTemplate defaultTemplate()
113 {
114 return LLMessageTemplate(_PREHASH_TestMessage, 1, MFT_HIGH);
115 }
63 }; 116 };
64 117
65 typedef test_group<LLSDMessageBuilderTestData> LLSDMessageBuilderTestGroup; 118 typedef test_group<LLSDMessageBuilderTestData> LLSDMessageBuilderTestGroup;
@@ -279,5 +332,509 @@ namespace tut
279 outValue = buffer; 332 outValue = buffer;
280 ensure_equals("Ensure String", inValue, outValue); 333 ensure_equals("Ensure String", inValue, outValue);
281 } 334 }
335
336 template<> template<>
337 void LLSDMessageBuilderTestObject::test<19>()
338 {
339 LLMsgBlkData* mbd = new LLMsgBlkData("testBlock", 0);
340 LLMsgData* md = new LLMsgData("testMessage");
341 md->addBlock(mbd);
342 LLSDMessageBuilder builder = defaultBuilder();
343
344 builder.copyFromMessageData(*md);
345 LLSD output = builder.getMessage();
346
347 ensure("Ensure message block created when copied from legacy message to llsd", output["testBlock"].isDefined());
348 }
349
350 // MVT_FIXED
351 template<> template<>
352 void LLSDMessageBuilderTestObject::test<20>()
353 {
354 char binData[] = "abcdefghijklmnop";
355
356 addValue(messageBlockData, "testBinData", &binData, MVT_FIXED, sizeof(binData));
357 messageData->addBlock(messageBlockData);
358 LLSDMessageBuilder builder = defaultBuilder();
359
360 builder.copyFromMessageData(*messageData);
361 LLSD output = builder.getMessage();
362
363 std::vector<U8> v = output["testBlock"][0]["testBinData"].asBinary();
364 ensure("Ensure MVT_S16Array data copied from legacy to llsd give a valid vector", v.size() > 0);
365
366 ensure_memory_matches("Ensure fixed binary data works in a message copied from legacy to llsd",
367 &v[0], sizeof(binData), binData, sizeof(binData));
368 }
369
370 // MVT_VARIABLE data_size 1 (U8's)
371 template<> template<>
372 void LLSDMessageBuilderTestObject::test<21>()
373 {
374 /* U8 binData[] = "abcdefghijklmnop";
375
376 addValue(messageBlockData, "testBinData", &binData, MVT_VARIABLE, sizeof(binData), 1);
377 messageData->addBlock(messageBlockData);
378 LLSDMessageBuilder builder = defaultBuilder();
379
380 builder.copyFromMessageData(*messageData);
381 LLSD output = builder.getMessage();
382
383 std::vector<U8> v = output["testBlock"][0]["testBinData"].asBinary();
384 ensure("Ensure MVT_S16Array data copied from legacy to llsd give a valid vector", v.size() > 0);
385
386 ensure_memory_matches("Ensure MVT_VARIABLE U8 binary data works in a message copied from legacy to llsd",
387 &v[0], sizeof(binData), binData, sizeof(binData));*/
388 }
389
390 // MVT_VARIABLE data_size 2 (U16's)
391 template<> template<>
392 void LLSDMessageBuilderTestObject::test<22>()
393 {
394 U16 binData[] = {1,2,3,4,5,6,7,8,9}; //9 shorts
395
396 addValue(messageBlockData, "testBinData", &binData, MVT_VARIABLE, sizeof(binData) >> 1, 2);
397 messageData->addBlock(messageBlockData);
398 LLSDMessageBuilder builder = defaultBuilder();
399
400 builder.copyFromMessageData(*messageData);
401 LLSD output = builder.getMessage();
402
403 std::vector<U8> v = output["testBlock"][0]["testBinData"].asBinary();
404 ensure("Ensure MVT_S16Array data copied from legacy to llsd give a valid vector", v.size() > 0);
405
406 ensure_memory_matches("Ensure MVT_VARIABLE U16 binary data works in a message copied from legacy to llsd",
407 &v[0], sizeof(binData) >> 1, binData, sizeof(binData) >> 1);
408 }
409
410 // MVT_VARIABLE data_size 4 (S32's)
411 template<> template<>
412 void LLSDMessageBuilderTestObject::test<23>()
413 {
414 U32 binData[] = {9,8,7,6,5,4,3,2,1};
415
416 addValue(messageBlockData, "testBinData", &binData, MVT_VARIABLE, sizeof(binData) >> 2, 4);
417 messageData->addBlock(messageBlockData);
418 LLSDMessageBuilder builder = defaultBuilder();
419
420 builder.copyFromMessageData(*messageData);
421 LLSD output = builder.getMessage();
422
423 std::vector<U8> v = output["testBlock"][0]["testBinData"].asBinary();
424 ensure("Ensure MVT_S16Array data copied from legacy to llsd give a valid vector", v.size() > 0);
425
426 ensure_memory_matches("Ensure MVT_VARIABLE S32 binary data works in a message copied from legacy to llsd",
427 &v[0], sizeof(binData) >> 2, binData, sizeof(binData) >> 2);
428 }
429
430 // MVT_U8
431 template<> template<>
432 void LLSDMessageBuilderTestObject::test<24>()
433 {
434 U8 data = 0xa5;
435
436 addValue(messageBlockData, "testBinData", &data, MVT_U8, sizeof(data));
437 messageData->addBlock(messageBlockData);
438 LLSDMessageBuilder builder = defaultBuilder();
439
440 builder.copyFromMessageData(*messageData);
441 LLSD output = builder.getMessage();
442
443 ensure_equals("Ensure MVT_U8 data works in a message copied from legacy to llsd",
444 output["testBlock"][0]["testBinData"].asInteger(), data);
445 }
446
447 // MVT_U16
448 template<> template<>
449 void LLSDMessageBuilderTestObject::test<25>()
450 {
451 U16 data = 0xa55a;
452
453 addValue(messageBlockData, "testBinData", &data, MVT_U16, sizeof(data));
454 messageData->addBlock(messageBlockData);
455 LLSDMessageBuilder builder = defaultBuilder();
456
457 builder.copyFromMessageData(*messageData);
458 LLSD output = builder.getMessage();
459
460 ensure_equals("Ensure MVT_U16 data works in a message copied from legacy to llsd",
461 output["testBlock"][0]["testBinData"].asInteger(), data);
462 }
463
464 // MVT_U32
465 template<> template<>
466 void LLSDMessageBuilderTestObject::test<26>()
467 {
468 U32 data = 0xa55a7117;
469
470 addValue(messageBlockData, "testBinData", &data, MVT_U32, sizeof(data));
471 messageData->addBlock(messageBlockData);
472 LLSDMessageBuilder builder = defaultBuilder();
473
474 builder.copyFromMessageData(*messageData);
475 LLSD output = builder.getMessage();
476
477 ensure_equals("Ensure MVT_U32 data works in a message copied from legacy to llsd",
478 ll_U32_from_sd(output["testBlock"][0]["testBinData"]), data);
479 }
480
481 // MVT_U64 - crush into an s32: LLSD does not support 64 bit values
482 template<> template<>
483 void LLSDMessageBuilderTestObject::test<27>()
484 {
485 U64 data = U64L(0xa55a711711223344);
486 addValue(messageBlockData, "testBinData", &data, MVT_U64, sizeof(data));
487 messageData->addBlock(messageBlockData);
488 LLSDMessageBuilder builder = defaultBuilder();
489
490 builder.copyFromMessageData(*messageData);
491 LLSD output = builder.getMessage();
492
493 ensure_equals("Ensure MVT_U64 data works in a message copied from legacy to llsd",
494 ll_U64_from_sd(output["testBlock"][0]["testBinData"]), data);
495 }
496
497 // MVT_S8
498 template<> template<>
499 void LLSDMessageBuilderTestObject::test<28>()
500 {
501 S8 data = -31;
502
503 addValue(messageBlockData, "testBinData", &data, MVT_S8, sizeof(data));
504 messageData->addBlock(messageBlockData);
505 LLSDMessageBuilder builder = defaultBuilder();
506
507 builder.copyFromMessageData(*messageData);
508 LLSD output = builder.getMessage();
509
510 ensure_equals("Ensure MVT_S8 data works in a message copied from legacy to llsd",
511 output["testBlock"][0]["testBinData"].asInteger(), data);
512 }
513
514 // MVT_S16
515 template<> template<>
516 void LLSDMessageBuilderTestObject::test<29>()
517 {
518 S16 data = -31;
519
520 addValue(messageBlockData, "testBinData", &data, MVT_S16, sizeof(data));
521 messageData->addBlock(messageBlockData);
522 LLSDMessageBuilder builder = defaultBuilder();
523
524 builder.copyFromMessageData(*messageData);
525 LLSD output = builder.getMessage();
526
527 ensure_equals("Ensure MVT_S16 data works in a message copied from legacy to llsd",
528 output["testBlock"][0]["testBinData"].asInteger(), data);
529 }
530
531 // MVT_S32
532 template<> template<>
533 void LLSDMessageBuilderTestObject::test<30>()
534 {
535 S32 data = -3100;
536
537 addValue(messageBlockData, "testBinData", &data, MVT_S32, sizeof(data));
538 messageData->addBlock(messageBlockData);
539 LLSDMessageBuilder builder = defaultBuilder();
540
541 builder.copyFromMessageData(*messageData);
542 LLSD output = builder.getMessage();
543
544 ensure_equals("Ensure MVT_S32 data works in a message copied from legacy to llsd",
545 output["testBlock"][0]["testBinData"].asInteger(), data);
546 }
547
548 // MVT_S64 - crush into an s32: LLSD does not support 64 bit values
549 template<> template<>
550 void LLSDMessageBuilderTestObject::test<31>()
551 {
552 S64 data = -31003100;
553
554 addValue(messageBlockData, "testBinData", &data, MVT_S64, sizeof(data));
555 messageData->addBlock(messageBlockData);
556 LLSDMessageBuilder builder = defaultBuilder();
557
558 builder.copyFromMessageData(*messageData);
559 LLSD output = builder.getMessage();
560
561 ensure_equals("Ensure MVT_S64 data works in a message copied from legacy to llsd",
562 output["testBlock"][0]["testBinData"].asInteger(), (S32)data);
563 }
564
565 // MVT_F32
566 template<> template<>
567 void LLSDMessageBuilderTestObject::test<32>()
568 {
569 F32 data = 1234.1234f;
570
571 addValue(messageBlockData, "testBinData", &data, MVT_F32, sizeof(data));
572 messageData->addBlock(messageBlockData);
573 LLSDMessageBuilder builder = defaultBuilder();
574
575 builder.copyFromMessageData(*messageData);
576 LLSD output = builder.getMessage();
577
578 ensure_equals("Ensure MVT_F32 data works in a message copied from legacy to llsd",
579 output["testBlock"][0]["testBinData"].asReal(), data);
580 }
581
582 // MVT_F64
583 template<> template<>
584 void LLSDMessageBuilderTestObject::test<33>()
585 {
586 F64 data = 1234.1234;
587
588 addValue(messageBlockData, "testBinData", &data, MVT_F64, sizeof(data));
589 messageData->addBlock(messageBlockData);
590 LLSDMessageBuilder builder = defaultBuilder();
591
592 builder.copyFromMessageData(*messageData);
593 LLSD output = builder.getMessage();
594
595 ensure_equals("Ensure MVT_F64 data works in a message copied from legacy to llsd",
596 output["testBlock"][0]["testBinData"].asReal(), data);
597 }
598
599 // MVT_LLVector3
600 template<> template<>
601 void LLSDMessageBuilderTestObject::test<34>()
602 {
603 LLVector3 data(1,2,3);
604
605 addValue(messageBlockData, "testBinData", &data, MVT_LLVector3, sizeof(data));
606 messageData->addBlock(messageBlockData);
607 LLSDMessageBuilder builder = defaultBuilder();
608
609 builder.copyFromMessageData(*messageData);
610 LLSD output = builder.getMessage();
611
612 ensure_equals("Ensure MVT_LLVector3 data works in a message copied from legacy to llsd",
613 ll_vector3_from_sd(output["testBlock"][0]["testBinData"]), data);
614 }
615
616 // MVT_LLVector3d
617 template<> template<>
618 void LLSDMessageBuilderTestObject::test<35>()
619 {
620 LLVector3d data(1,2,3);
621
622 addValue(messageBlockData, "testBinData", &data, MVT_LLVector3d, sizeof(data));
623 messageData->addBlock(messageBlockData);
624 LLSDMessageBuilder builder = defaultBuilder();
625
626 builder.copyFromMessageData(*messageData);
627 LLSD output = builder.getMessage();
628
629 ensure_equals("Ensure MVT_LLVector3 data works in a message copied from legacy to llsd",
630 ll_vector3d_from_sd(output["testBlock"][0]["testBinData"]), data);
631 }
632
633 // MVT_LLVector4
634 template<> template<>
635 void LLSDMessageBuilderTestObject::test<36>()
636 {
637 LLVector4 data(1,2,3,4);
638 LLSD v = ll_sd_from_vector4(data);
639
640 addValue(messageBlockData, "testBinData", &data, MVT_LLVector4, sizeof(data));
641 messageData->addBlock(messageBlockData);
642 LLSDMessageBuilder builder = defaultBuilder();
643
644 builder.copyFromMessageData(*messageData);
645 LLSD output = builder.getMessage();
646
647 ensure_equals("Ensure MVT_LLVector4 data works in a message copied from legacy to llsd",
648 output["testBlock"][0]["testBinData"], v);
649 }
650
651 // MVT_LLQuaternion
652 template<> template<>
653 void LLSDMessageBuilderTestObject::test<37>()
654 {
655 LLQuaternion data(1,2,3,0);
656
657 //we send a quaternion packed into a vec3 (w is infered) - so sizeof(vec) == 12 bytes not 16.
658 LLVector3 vec = data.packToVector3();
659
660 addValue(messageBlockData, "testBinData", &vec, MVT_LLQuaternion, sizeof(vec));
661 messageData->addBlock(messageBlockData);
662 LLSDMessageBuilder builder = defaultBuilder();
663
664 builder.copyFromMessageData(*messageData);
665 LLSD output = builder.getMessage();
666
667 ensure_equals("Ensure MVT_LLQuaternion data works in a message copied from legacy to llsd",
668 ll_quaternion_from_sd(output["testBlock"][0]["testBinData"]), data);
669 }
670
671 // MVT_LLUUID
672 template<> template<>
673 void LLSDMessageBuilderTestObject::test<38>()
674 {
675 LLUUID data("01234567-0123-0123-0123-234567abcdef");
676
677 addValue(messageBlockData, "testBinData", &data, MVT_LLUUID, sizeof(data));
678 messageData->addBlock(messageBlockData);
679 LLSDMessageBuilder builder = defaultBuilder();
680
681 builder.copyFromMessageData(*messageData);
682 LLSD output = builder.getMessage();
683
684 std::string v = output["testBlock"][0]["testBinData"].asUUID().asString();
685
686 ensure_equals("Ensure MVT_LLUUID data works in a message copied from legacy to llsd",
687 output["testBlock"][0]["testBinData"].asUUID(), data);
688 }
689
690 // MVT_BOOL
691 template<> template<>
692 void LLSDMessageBuilderTestObject::test<39>()
693 {
694 BOOL valueTrue = true;
695 BOOL valueFalse = false;
696
697 LLMsgData* md = new LLMsgData("testMessage");
698 LLMsgBlkData* mbd = new LLMsgBlkData("testBlock", 0);
699 addValue(mbd, "testBoolFalse", &valueFalse, MVT_BOOL, sizeof(BOOL));
700 addValue(mbd, "testBoolTrue", &valueTrue, MVT_BOOL, sizeof(BOOL));
701 md->addBlock(mbd);
702 LLSDMessageBuilder builder = defaultBuilder();
703
704 builder.copyFromMessageData(*md);
705 LLSD output = builder.getMessage();
706
707 ensure("Ensure bools work in a message copied from legacy to llsd",
708 output["testBlock"][0]["testBoolTrue"].asBoolean() && !output["testBlock"][0]["testBoolFalse"].asBoolean());
709 }
710
711 // MVT_IP_ADDR
712 template<> template<>
713 void LLSDMessageBuilderTestObject::test<40>()
714 {
715 U32 data(0xff887766);
716 LLSD v = ll_sd_from_ipaddr(data);
717
718 addValue(messageBlockData, "testBinData", &data, MVT_IP_ADDR, sizeof(data));
719 messageData->addBlock(messageBlockData);
720 LLSDMessageBuilder builder = defaultBuilder();
721
722 builder.copyFromMessageData(*messageData);
723 LLSD output = builder.getMessage();
724
725 ensure_equals("Ensure MVT_IP_ADDR data works in a message copied from legacy to llsd",
726 output["testBlock"][0]["testBinData"], v);
727 }
728
729 // MVT_IP_PORT
730 template<> template<>
731 void LLSDMessageBuilderTestObject::test<41>()
732 {
733 U16 data = 0xff88;
734
735 addValue(messageBlockData, "testBinData", &data, MVT_IP_PORT, sizeof(data));
736 messageData->addBlock(messageBlockData);
737 LLSDMessageBuilder builder = defaultBuilder();
738
739 builder.copyFromMessageData(*messageData);
740 LLSD output = builder.getMessage();
741
742 ensure_equals("Ensure MVT_IP_PORT data works in a message copied from legacy to llsd",
743 output["testBlock"][0]["testBinData"].asInteger(), data);
744 }
745
746 // MVT_U16Vec3
747 template<> template<>
748 void LLSDMessageBuilderTestObject::test<42>()
749 {
750 U16 data[3] = {0,1,2};
751
752 addValue(messageBlockData, "testBinData", &data, MVT_U16Vec3, sizeof(data));
753 messageData->addBlock(messageBlockData);
754 LLSDMessageBuilder builder = defaultBuilder();
755
756 builder.copyFromMessageData(*messageData);
757 LLSD output = builder.getMessage();
758
759 std::vector<U8> v = output["testBlock"][0]["testBinData"].asBinary();
760 ensure("Ensure MVT_U16Vec3 data copied from legacy to llsd give a valid vector", v.size() > 0);
761
762 ensure_memory_matches("Ensure MVT_U16Vec3 data works in a message copied from legacy to llsd",
763 (U16*)&v[0], 6, data, 6);
764 }
765
766 // MVT_U16Quat
767 template<> template<>
768 void LLSDMessageBuilderTestObject::test<43>()
769 {
770 U16 data[4] = {0,1,2,4};
771
772 addValue(messageBlockData, "testBinData", &data, MVT_U16Quat, sizeof(data));
773 messageData->addBlock(messageBlockData);
774 LLSDMessageBuilder builder = defaultBuilder();
775
776 builder.copyFromMessageData(*messageData);
777 LLSD output = builder.getMessage();
778
779 std::vector<U8> v = output["testBlock"][0]["testBinData"].asBinary();
780 ensure("Ensure MVT_U16Quat data copied from legacy to llsd give a valid vector", v.size() > 0);
781
782 ensure_memory_matches("Ensure MVT_U16Quat data works in a message copied from legacy to llsd",
783 (U16*)&v[0], 8, data, 8);
784 }
785
786 // MVT_S16Array
787 template<> template<>
788 void LLSDMessageBuilderTestObject::test<44>()
789 {
790 S16 data[19] = {0,-1,2,-4,5,-6,7,-8,9,-10,11,-12,13,-14,15,16,17,18};
791
792 addValue(messageBlockData, "testBinData", &data, MVT_S16Array, sizeof(data));
793 messageData->addBlock(messageBlockData);
794 LLSDMessageBuilder builder = defaultBuilder();
795
796 builder.copyFromMessageData(*messageData);
797 LLSD output = builder.getMessage();
798
799 std::vector<U8> v = output["testBlock"][0]["testBinData"].asBinary();
800 ensure("Ensure MVT_S16Array data copied from legacy to llsd give a valid vector", v.size() > 0);
801
802 ensure_memory_matches("Ensure MVT_S16Array data works in a message copied from legacy to llsd",
803 (U16*)&v[0], 19, data, 19);
804 }
805
806 template<> template<>
807 void LLSDMessageBuilderTestObject::test<45>()
808 {
809 LLMessageTemplate messageTemplate = defaultTemplate();
810 messageTemplate.addBlock(defaultTemplateBlock(MVT_U8, 1));
811 U8 inValue = 2;
812 LLTemplateMessageBuilder* template_builder = defaultTemplateBuilder(messageTemplate);
813 template_builder->addU8(_PREHASH_Test0, inValue);
814
815 LLSDMessageBuilder builder;
816 builder.copyFromMessageData(*template_builder->getCurrentMessage());
817 LLSD output = builder.getMessage();
818
819 ensure_equals(output["Test0"][0]["Test0"].asInteger(), 2);
820
821 }
822
823 template<> template<>
824 void LLSDMessageBuilderTestObject::test<46>()
825 {
826 LLMessageTemplate messageTemplate = defaultTemplate();
827 messageTemplate.addBlock(defaultTemplateBlock(MVT_VARIABLE, 1));
828 std::string inValue = "testing";
829 LLTemplateMessageBuilder* builder = defaultTemplateBuilder(messageTemplate);
830 builder->addString(_PREHASH_Test0, inValue.c_str());
831
832 LLSDMessageBuilder sd_builder;
833 sd_builder.copyFromMessageData(*builder->getCurrentMessage());
834 LLSD output = sd_builder.getMessage();
835
836 ensure_equals(output["Test0"][0]["Test0"].asString(), std::string("testing"));
837 }
838
282} 839}
283 840
diff --git a/linden/indra/test/llsdmessagereader_tut.cpp b/linden/indra/test/llsdmessagereader_tut.cpp
index f94fef3..36cfe5e 100755
--- a/linden/indra/test/llsdmessagereader_tut.cpp
+++ b/linden/indra/test/llsdmessagereader_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34#include "linden_common.h" 35#include "linden_common.h"
35#include "lltut.h" 36#include "lltut.h"
36#include "v3dmath.h" 37#include "v3dmath.h"
diff --git a/linden/indra/test/llsdserialize_tut.cpp b/linden/indra/test/llsdserialize_tut.cpp
index 467470a..6fcbe4b 100644
--- a/linden/indra/test/llsdserialize_tut.cpp
+++ b/linden/indra/test/llsdserialize_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34 35
35#if !LL_WINDOWS 36#if !LL_WINDOWS
36#include <netinet/in.h> 37#include <netinet/in.h>
@@ -242,7 +243,7 @@ namespace tut
242 243
243 try 244 try
244 { 245 {
245 ensure_equals(msg, w, v); 246 ensure_equals(msg.c_str(), w, v);
246 } 247 }
247 catch (...) 248 catch (...)
248 { 249 {
@@ -490,7 +491,7 @@ namespace tut
490 LLSD parsed_result; 491 LLSD parsed_result;
491 mParser->reset(); // reset() call is needed since test code re-uses mParser 492 mParser->reset(); // reset() call is needed since test code re-uses mParser
492 S32 parsed_count = mParser->parse(input, parsed_result, in.size()); 493 S32 parsed_count = mParser->parse(input, parsed_result, in.size());
493 ensure_equals(msg, parsed_result, expected_value); 494 ensure_equals(msg.c_str(), parsed_result, expected_value);
494 495
495 // This count check is really only useful for expected 496 // This count check is really only useful for expected
496 // parse failures, since the ensures equal will already 497 // parse failures, since the ensures equal will already
@@ -1283,7 +1284,7 @@ namespace tut
1283 count4, 1284 count4,
1284 count3); 1285 count3);
1285 ensure_equals( 1286 ensure_equals(
1286 msg + " (binaryandnotation)", 1287 (msg + " (binaryandnotation)").c_str(),
1287 actual_value_notation, 1288 actual_value_notation,
1288 input); 1289 input);
1289 } 1290 }
@@ -1318,7 +1319,7 @@ namespace tut
1318 "ensureBinaryAndXML xml count2", 1319 "ensureBinaryAndXML xml count2",
1319 count4, 1320 count4,
1320 count3); 1321 count3);
1321 ensure_equals(msg + " (binaryandxml)", actual_value_xml, input); 1322 ensure_equals((msg + " (binaryandxml)").c_str(), actual_value_xml, input);
1322 } 1323 }
1323 }; 1324 };
1324 1325
diff --git a/linden/indra/test/llsdtraits.h b/linden/indra/test/llsdtraits.h
index b652f6c..efe2dd5 100644
--- a/linden/indra/test/llsdtraits.h
+++ b/linden/indra/test/llsdtraits.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llsdutil_tut.cpp b/linden/indra/test/llsdutil_tut.cpp
index 63e3d31..0c4bbc2 100644
--- a/linden/indra/test/llsdutil_tut.cpp
+++ b/linden/indra/test/llsdutil_tut.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,
diff --git a/linden/indra/test/llservicebuilder_tut.cpp b/linden/indra/test/llservicebuilder_tut.cpp
index 4b5a76a..e6cf46f 100644
--- a/linden/indra/test/llservicebuilder_tut.cpp
+++ b/linden/indra/test/llservicebuilder_tut.cpp
@@ -18,7 +18,8 @@
18* There are special exceptions to the terms and conditions of the GPL as 18* There are special exceptions to the terms and conditions of the GPL as
19* it is applied to this Source Code. View the full text of the exception 19* it is applied to this Source Code. View the full text of the exception
20* in the file doc/FLOSS-exception.txt in this software distribution, or 20* in the file doc/FLOSS-exception.txt in this software distribution, or
21* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21* online at
22* http://secondlifegrid.net/programs/open_source/licensing/flossexception
22* 23*
23* By copying, modifying or distributing this software, you acknowledge 24* By copying, modifying or distributing this software, you acknowledge
24* that you have read and understood your obligations described above, 25* that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30* $/LicenseInfo$ 31* $/LicenseInfo$
31*/ 32*/
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34 35
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
diff --git a/linden/indra/test/llstreamtools_tut.cpp b/linden/indra/test/llstreamtools_tut.cpp
index b96c2c4..089ba4f 100644
--- a/linden/indra/test/llstreamtools_tut.cpp
+++ b/linden/indra/test/llstreamtools_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35 36
36#include "linden_common.h" 37#include "linden_common.h"
37#include "llstreamtools.h" 38#include "llstreamtools.h"
diff --git a/linden/indra/test/llstring_tut.cpp b/linden/indra/test/llstring_tut.cpp
index d17dd15..b622107 100644
--- a/linden/indra/test/llstring_tut.cpp
+++ b/linden/indra/test/llstring_tut.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,
@@ -33,7 +34,7 @@
33 34
34#include "linden_common.h" 35#include "linden_common.h"
35 36
36#include <tut/tut.h> 37#include <tut/tut.hpp>
37#include "lltut.h" 38#include "lltut.h"
38#include "llstring.h" 39#include "llstring.h"
39 40
@@ -417,8 +418,8 @@ namespace tut
417 template<> template<> 418 template<> template<>
418 void string_index_object_t::test<26>() 419 void string_index_object_t::test<26>()
419 { 420 {
420 char* str1 = NULL; 421 const char* str1 = NULL;
421 char* str2 = NULL; 422 const char* str2 = NULL;
422 423
423 ensure("1: compareStrings failed", LLStringUtil::compareStrings(str1, str2) == 0); 424 ensure("1: compareStrings failed", LLStringUtil::compareStrings(str1, str2) == 0);
424 str2 = "A"; 425 str2 = "A";
@@ -436,8 +437,8 @@ namespace tut
436 template<> template<> 437 template<> template<>
437 void string_index_object_t::test<27>() 438 void string_index_object_t::test<27>()
438 { 439 {
439 char* str1 = NULL; 440 const char* str1 = NULL;
440 char* str2 = NULL; 441 const char* str2 = NULL;
441 442
442 ensure("1: compareInsensitive failed", LLStringUtil::compareInsensitive(str1, str2) == 0); 443 ensure("1: compareInsensitive failed", LLStringUtil::compareInsensitive(str1, str2) == 0);
443 str2 = "A"; 444 str2 = "A";
diff --git a/linden/indra/test/lltemplatemessagebuilder_tut.cpp b/linden/indra/test/lltemplatemessagebuilder_tut.cpp
index 6460013..5b33d02 100644
--- a/linden/indra/test/lltemplatemessagebuilder_tut.cpp
+++ b/linden/indra/test/lltemplatemessagebuilder_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34#include "linden_common.h" 35#include "linden_common.h"
35#include "lltut.h" 36#include "lltut.h"
36 37
@@ -59,6 +60,9 @@ namespace tut
59 if(! init) 60 if(! init)
60 { 61 {
61 ll_init_apr(); 62 ll_init_apr();
63 const F32 circuit_heartbeat_interval=5;
64 const F32 circuit_timeout=100;
65
62 start_messaging_system("notafile", 13035, 66 start_messaging_system("notafile", 13035,
63 LL_VERSION_MAJOR, 67 LL_VERSION_MAJOR,
64 LL_VERSION_MINOR, 68 LL_VERSION_MINOR,
@@ -66,7 +70,9 @@ namespace tut
66 FALSE, 70 FALSE,
67 "notasharedsecret", 71 "notasharedsecret",
68 NULL, 72 NULL,
69 false); 73 false,
74 circuit_heartbeat_interval,
75 circuit_timeout);
70 //init_prehash_data(); 76 //init_prehash_data();
71 init = true; 77 init = true;
72 } 78 }
diff --git a/linden/indra/test/lltimestampcache_tut.cpp b/linden/indra/test/lltimestampcache_tut.cpp
new file mode 100644
index 0000000..3b102a3
--- /dev/null
+++ b/linden/indra/test/lltimestampcache_tut.cpp
@@ -0,0 +1,130 @@
1/**
2 * @file lltimestampcache_tut.cpp
3 * @author James Tess
4 * @date 2008-12-03
5 *
6 * $LicenseInfo:firstyear=2008&license=viewergpl$
7 *
8 * Copyright (c) 2008-2009, Linden Research, Inc.
9 *
10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 *
18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33
34#include <tut/tut.hpp>
35
36#include "linden_common.h"
37#include "../mapserver/lltimestampcache.h"
38#include "lltut.h"
39
40
41namespace tut
42{
43 struct LLTimestampCacheTestData
44 {
45 };
46
47 typedef test_group<LLTimestampCacheTestData> LLTimestampCacheTestGroup;
48 typedef LLTimestampCacheTestGroup::object LLTimestampCacheTestObject;
49
50 LLTimestampCacheTestGroup timestampCacheTestGroup("LLTimestampCache");
51
52 // Most common usage
53 template<> template<>
54 void LLTimestampCacheTestObject::test<1>()
55 {
56 LLTimestampCache<std::string, std::string> cache;
57 // put in some data
58 cache.insert("key1", "val1", 1);
59 cache.insert("key2", "val2", 2);
60 cache.insert("key3", "val3", 3);
61 ensure_equals("size is 3", cache.size(), 3);
62 // check some items
63 ensure("has key1", cache.has("key1"));
64 ensure("no invalid key", !cache.has("invalid key"));
65 // get some items
66 ensure_equals("get key1", cache.get("key1", 4), "val1");
67 ensure_equals("get invalid key",
68 cache.get("invalid key", 4), std::string() );
69 // timestamps
70 ensure_equals("key1 timestamp updated", cache.getTimestamp("key1"), 4);
71 ensure_equals("invalid key timestamp",
72 cache.getTimestamp("invalid key"), 0);
73 }
74
75 // New empty cache shouldn't have any entries
76 template<> template<>
77 void LLTimestampCacheTestObject::test<2>()
78 {
79 LLTimestampCache<std::string, std::string> cache;
80 ensure_equals("starts empty", cache.size(), 0);
81 ensure_equals("has nothing", cache.has("foo"), false);
82 ensure_equals("gets nothing", cache.get("foo", 0), std::string() );
83 U32 max_time = 0xFFFFFFFF;
84 ensure_equals("erases nothing", cache.eraseBefore(max_time), 0);
85 }
86
87 // Non empty cache
88 template<> template<>
89 void LLTimestampCacheTestObject::test<3>()
90 {
91 LLTimestampCache<std::string, std::string> cache;
92 cache.insert("foo", "bar", 123);
93 ensure_equals("size one", cache.size(), 1);
94 ensure_equals("has it", cache.has("foo"), true);
95 ensure_equals("timestamp correct", cache.getTimestamp("foo"), 123);
96 std::string value = cache.get("foo", 456);
97 ensure_equals("get value", value, "bar");
98 ensure_equals("timestamp updated", cache.getTimestamp("foo"), 456);
99 ensure_equals("erase nothing", cache.eraseBefore(0), 0);
100 ensure_equals("erase one", cache.eraseBefore(789), 1);
101 ensure_equals("empty after erase", cache.size(), 0);
102 }
103
104 // Recache of item should update timestamp
105 template<> template<>
106 void LLTimestampCacheTestObject::test<4>()
107 {
108 LLTimestampCache<std::string, std::string> cache;
109 cache.insert("foo", "bar", 123);
110 cache.insert("foo", "bar", 456);
111 ensure_equals("duplicate suppressed", cache.size(), 1);
112 ensure_equals("timestamp replaced", cache.getTimestamp("foo"), 456);
113 }
114
115 // Erasing some items
116 template<> template<>
117 void LLTimestampCacheTestObject::test<5>()
118 {
119 LLTimestampCache<std::string, std::string> cache;
120 cache.insert("key1", "val1", 1);
121 cache.insert("key2", "val2", 2);
122 cache.insert("key3", "val3", 3);
123 cache.insert("key4", "val4", 4);
124 size_t erased = cache.eraseBefore(3);
125 ensure_equals("erase range", erased, 2);
126 ensure_equals("cache post erase", cache.size(), 2);
127 ensure_equals("has key3", cache.has("key3"), true);
128 ensure_equals("not has key2", cache.has("key2"), false);
129 }
130}
diff --git a/linden/indra/test/lltiming_tut.cpp b/linden/indra/test/lltiming_tut.cpp
index c6cf643..4ca6cb5 100644
--- a/linden/indra/test/lltiming_tut.cpp
+++ b/linden/indra/test/lltiming_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/lltranscode_tut.cpp b/linden/indra/test/lltranscode_tut.cpp
new file mode 100644
index 0000000..eb21979
--- /dev/null
+++ b/linden/indra/test/lltranscode_tut.cpp
@@ -0,0 +1,95 @@
1/**
2 * @file llscriptresource_tut.cpp
3 * @brief Test LLScriptResource
4 *
5 * $LicenseInfo:firstyear=2008&license=viewergpl$
6 *
7 * Copyright (c) 2008-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33//#include <tut/tut.h>
34#include "linden_common.h"
35
36#include "lltut.h"
37
38#include "../newsim/lltranscode.cpp" // include TU to pull in newsim implementation.
39
40static const char test_utf8[] = "Edelwei\xc3\x9f";
41static const char test_utf7[] = "Edelwei+AN8-";
42static const char test_latin1[] = "Edelwei\xdf";
43static const char test_latin2[] = "Edelwei\xdf";
44
45namespace tut
46{
47 class LLTranscodeTestData
48 {
49 };
50
51 typedef test_group<LLTranscodeTestData> LLTranscodeTestGroup;
52 typedef LLTranscodeTestGroup::object LLTranscodeTestObject;
53 LLTranscodeTestGroup transcodeTestGroup("transcode");
54
55 template<> template<>
56 void LLTranscodeTestObject::test<1>()
57 {
58#if LL_WINDOWS
59 skip("Windows APR libs can't transcode.");
60#endif
61 // Test utf8
62 std::stringstream input;
63 std::stringstream output;
64
65 input.str(test_utf7);
66 output.clear();
67 LLTranscode::transcode("charset=UTF-7", input, output);
68 ensure_equals("UTF-7 to UTF-8 transcoding", output.str(),
69 std::string(test_utf8));
70
71 input.str(test_latin1);
72 output.clear();
73 LLTranscode::transcode("", input, output);
74 ensure_equals("Default (latin_1) to UTF8 transcoding", output.str(),
75 std::string(test_utf8));
76
77 input.str(test_latin1);
78 output.clear();
79 LLTranscode::transcode("charset=iso-8859-1", input, output);
80 ensure_equals("latin_1 (ISO-8859-1) to UTF8 transcoding", output.str(),
81 std::string(test_utf8));
82
83 input.str(test_latin2);
84 output.clear();
85 LLTranscode::transcode("charset=iso-8859-2", input, output);
86 ensure_equals("latin_2 (ISO-8859-2) to UTF8 transcoding", output.str(),
87 std::string(test_utf8));
88
89 input.str(test_utf8);
90 output.clear();
91 LLTranscode::transcode("charset=utf-8", input, output);
92 ensure_equals("UTF8 to UTF8 transcoding", output.str(),
93 std::string(test_utf8));
94 }
95}
diff --git a/linden/indra/test/lltut.cpp b/linden/indra/test/lltut.cpp
index bea6716..201e174 100644
--- a/linden/indra/test/lltut.cpp
+++ b/linden/indra/test/lltut.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,
@@ -32,14 +33,16 @@
32 */ 33 */
33 34
34#include "linden_common.h" 35#include "linden_common.h"
36
35#include "lltut.h" 37#include "lltut.h"
36 38
39#include "lldate.h"
37#include "llformat.h" 40#include "llformat.h"
38#include "llsd.h" 41#include "llsd.h"
42#include "lluri.h"
39 43
40namespace tut 44namespace tut
41{ 45{
42 template<>
43 void ensure_equals(const char* msg, const LLDate& actual, 46 void ensure_equals(const char* msg, const LLDate& actual,
44 const LLDate& expected) 47 const LLDate& expected)
45 { 48 {
@@ -47,7 +50,6 @@ namespace tut
47 actual.secondsSinceEpoch(), expected.secondsSinceEpoch()); 50 actual.secondsSinceEpoch(), expected.secondsSinceEpoch());
48 } 51 }
49 52
50 template<>
51 void ensure_equals(const char* msg, const LLURI& actual, 53 void ensure_equals(const char* msg, const LLURI& actual,
52 const LLURI& expected) 54 const LLURI& expected)
53 { 55 {
@@ -55,7 +57,6 @@ namespace tut
55 actual.asString(), expected.asString()); 57 actual.asString(), expected.asString());
56 } 58 }
57 59
58 template<>
59 void ensure_equals(const char* msg, 60 void ensure_equals(const char* msg,
60 const std::vector<U8>& actual, const std::vector<U8>& expected) 61 const std::vector<U8>& actual, const std::vector<U8>& expected)
61 { 62 {
@@ -73,11 +74,10 @@ namespace tut
73 } 74 }
74 } 75 }
75 76
76 template<>
77 void ensure_equals(const char* m, const LLSD& actual, 77 void ensure_equals(const char* m, const LLSD& actual,
78 const LLSD& expected) 78 const LLSD& expected)
79 { 79 {
80 const std::string& msg = m; 80 const std::string& msg = m ? m : "";
81 81
82 ensure_equals(msg + " type", actual.type(), expected.type()); 82 ensure_equals(msg + " type", actual.type(), expected.type());
83 switch (actual.type()) 83 switch (actual.type())
@@ -128,7 +128,7 @@ namespace tut
128 { 128 {
129 ensure_equals(msg + " map keys", 129 ensure_equals(msg + " map keys",
130 actual_iter->first, expected_iter->first); 130 actual_iter->first, expected_iter->first);
131 ensure_equals(msg + "[" + actual_iter->first + "]", 131 ensure_equals((msg + "[" + actual_iter->first + "]").c_str(),
132 actual_iter->second, expected_iter->second); 132 actual_iter->second, expected_iter->second);
133 ++actual_iter; 133 ++actual_iter;
134 ++expected_iter; 134 ++expected_iter;
@@ -141,7 +141,7 @@ namespace tut
141 141
142 for(int i = 0; i < actual.size(); ++i) 142 for(int i = 0; i < actual.size(); ++i)
143 { 143 {
144 ensure_equals(msg + llformat("[%d]", i), 144 ensure_equals((msg + llformat("[%d]", i)).c_str(),
145 actual[i], expected[i]); 145 actual[i], expected[i]);
146 } 146 }
147 return; 147 return;
@@ -199,3 +199,4 @@ namespace tut
199 } 199 }
200 } 200 }
201} 201}
202
diff --git a/linden/indra/test/lltut.h b/linden/indra/test/lltut.h
index 5c905b2..3a0cc04 100644
--- a/linden/indra/test/lltut.h
+++ b/linden/indra/test/lltut.h
@@ -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,
@@ -34,13 +35,13 @@
34#ifndef LL_LLTUT_H 35#ifndef LL_LLTUT_H
35#define LL_LLTUT_H 36#define LL_LLTUT_H
36 37
37#include <tut/tut.h> 38#include "is_approx_equal_fraction.h" // instead of llmath.h
38 39
39#include "lldate.h" 40#include <tut/tut.hpp>
40#include "lluri.h"
41#include "llmath.h"
42 41
42class LLDate;
43class LLSD; 43class LLSD;
44class LLURI;
44 45
45namespace tut 46namespace tut
46{ 47{
@@ -108,19 +109,15 @@ namespace tut
108 const Q& actual,const T& expected) 109 const Q& actual,const T& expected)
109 { ensure_equals(msg.c_str(), actual, expected); } 110 { ensure_equals(msg.c_str(), actual, expected); }
110 111
111 template<>
112 void ensure_equals(const char* msg, 112 void ensure_equals(const char* msg,
113 const LLDate& actual, const LLDate& expected); 113 const LLDate& actual, const LLDate& expected);
114 114
115 template<>
116 void ensure_equals(const char* msg, 115 void ensure_equals(const char* msg,
117 const LLURI& actual, const LLURI& expected); 116 const LLURI& actual, const LLURI& expected);
118 117
119 template<>
120 void ensure_equals(const char* msg, 118 void ensure_equals(const char* msg,
121 const std::vector<U8>& actual, const std::vector<U8>& expected); 119 const std::vector<U8>& actual, const std::vector<U8>& expected);
122 120
123 template<>
124 void ensure_equals(const char* msg, 121 void ensure_equals(const char* msg,
125 const LLSD& actual, const LLSD& expected); 122 const LLSD& actual, const LLSD& expected);
126 123
diff --git a/linden/indra/test/lluri_tut.cpp b/linden/indra/test/lluri_tut.cpp
index b4541da..2ee15be 100644
--- a/linden/indra/test/lluri_tut.cpp
+++ b/linden/indra/test/lluri_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/lluserrelations_tut.cpp b/linden/indra/test/lluserrelations_tut.cpp
index d07d4b9..4e3cc41 100644
--- a/linden/indra/test/lluserrelations_tut.cpp
+++ b/linden/indra/test/lluserrelations_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35 36
36#include "linden_common.h" 37#include "linden_common.h"
37#include "lluserrelations.h" 38#include "lluserrelations.h"
diff --git a/linden/indra/test/lluuidhashmap_tut.cpp b/linden/indra/test/lluuidhashmap_tut.cpp
index 3eac5df..3c6c9cb 100644
--- a/linden/indra/test/lluuidhashmap_tut.cpp
+++ b/linden/indra/test/lluuidhashmap_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lluuidhashmap.h" 37#include "lluuidhashmap.h"
37#include "llsdserialize.h" 38#include "llsdserialize.h"
diff --git a/linden/indra/test/llxfer_tut.cpp b/linden/indra/test/llxfer_tut.cpp
index 527441d..3adc59c 100644
--- a/linden/indra/test/llxfer_tut.cpp
+++ b/linden/indra/test/llxfer_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/llxorcipher_tut.cpp b/linden/indra/test/llxorcipher_tut.cpp
index e466aa2..7586edd 100644
--- a/linden/indra/test/llxorcipher_tut.cpp
+++ b/linden/indra/test/llxorcipher_tut.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,
diff --git a/linden/indra/test/m3math_tut.cpp b/linden/indra/test/m3math_tut.cpp
index 9c25925..05007cc 100644
--- a/linden/indra/test/m3math_tut.cpp
+++ b/linden/indra/test/m3math_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "lltut.h" 36#include "lltut.h"
36#include "linden_common.h" 37#include "linden_common.h"
37#include "m3math.h" 38#include "m3math.h"
diff --git a/linden/indra/test/mass_properties_tut.cpp b/linden/indra/test/mass_properties_tut.cpp
index f7f994b..4180065 100644
--- a/linden/indra/test/mass_properties_tut.cpp
+++ b/linden/indra/test/mass_properties_tut.cpp
@@ -4,16 +4,27 @@
4 * @date 2007-12-20 4 * @date 2007-12-20
5 * @brief Tests for the LLPrimMassProperties and LLObjectMassProperties classes 5 * @brief Tests for the LLPrimMassProperties and LLObjectMassProperties classes
6 * 6 *
7 * $LicenseInfo:firstyear=2007&license=internal$ 7 * $LicenseInfo:firstyear=2007&license=viewergpl$
8 * 8 *
9 * Copyright (c) 2007-2009, Linden Research, Inc. 9 * Copyright (c) 2007-2009, Linden Research, Inc.
10 * 10 *
11 * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of 11 * Second Life Viewer Source Code
12 * this source code is governed by the Linden Lab Source Code Disclosure 12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * Agreement ("Agreement") previously entered between you and Linden 13 * to you under the terms of the GNU General Public License, version 2.0
14 * Lab. By accessing, using, copying, modifying or distributing this 14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * software, you acknowledge that you have been informed of your 15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * obligations under the Agreement and agree to abide by those obligations. 16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
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
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 *
25 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above,
27 * and agree to abide by those obligations.
17 * 28 *
18 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 29 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
19 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 30 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
diff --git a/linden/indra/test/math.cpp b/linden/indra/test/math.cpp
index 3b9c6ef..308569f 100644
--- a/linden/indra/test/math.cpp
+++ b/linden/indra/test/math.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,
diff --git a/linden/indra/test/message_tut.cpp b/linden/indra/test/message_tut.cpp
index ca3729d..3fede26 100644
--- a/linden/indra/test/message_tut.cpp
+++ b/linden/indra/test/message_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34#include "linden_common.h" 35#include "linden_common.h"
35#include "lltut.h" 36#include "lltut.h"
36 37
@@ -50,6 +51,7 @@ namespace
50 { 51 {
51 mStatus = code; 52 mStatus = code;
52 } 53 }
54 virtual void extendedResult(S32 code, const std::string& message, const LLSD& headers) { }
53 S32 mStatus; 55 S32 mStatus;
54 }; 56 };
55} 57}
@@ -70,6 +72,9 @@ namespace tut
70 //init_prehash_data(); 72 //init_prehash_data();
71 init = true; 73 init = true;
72 } 74 }
75 const F32 circuit_heartbeat_interval=5;
76 const F32 circuit_timeout=100;
77
73 78
74 // currently test disconnected message system 79 // currently test disconnected message system
75 start_messaging_system("notafile", 13035, 80 start_messaging_system("notafile", 13035,
@@ -79,7 +84,10 @@ namespace tut
79 FALSE, 84 FALSE,
80 "notasharedsecret", 85 "notasharedsecret",
81 NULL, 86 NULL,
82 false); 87 false,
88 circuit_heartbeat_interval,
89 circuit_timeout
90 );
83 // generate temp dir 91 // generate temp dir
84 std::ostringstream ostr; 92 std::ostringstream ostr;
85#if LL_WINDOWS 93#if LL_WINDOWS
diff --git a/linden/indra/test/mock_http_client.cpp b/linden/indra/test/mock_http_client.cpp
index 4230630..7bcc781 100644
--- a/linden/indra/test/mock_http_client.cpp
+++ b/linden/indra/test/mock_http_client.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/mock_http_client.h b/linden/indra/test/mock_http_client.h
index cf8f9bf..067d933 100644
--- a/linden/indra/test/mock_http_client.h
+++ b/linden/indra/test/mock_http_client.h
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
diff --git a/linden/indra/test/prim_linkability_tut.cpp b/linden/indra/test/prim_linkability_tut.cpp
index 7198af1..a1bb31d 100644
--- a/linden/indra/test/prim_linkability_tut.cpp
+++ b/linden/indra/test/prim_linkability_tut.cpp
@@ -4,16 +4,27 @@
4 * @date 2007-04-23 4 * @date 2007-04-23
5 * @brief Tests for the LLPrimLinkInfo template which computes the linkability of prims 5 * @brief Tests for the LLPrimLinkInfo template which computes the linkability of prims
6 * 6 *
7 * $LicenseInfo:firstyear=2007&license=internal$ 7 * $LicenseInfo:firstyear=2007&license=viewergpl$
8 * 8 *
9 * Copyright (c) 2007-2009, Linden Research, Inc. 9 * Copyright (c) 2007-2009, Linden Research, Inc.
10 * 10 *
11 * The following source code is PROPRIETARY AND CONFIDENTIAL. Use of 11 * Second Life Viewer Source Code
12 * this source code is governed by the Linden Lab Source Code Disclosure 12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * Agreement ("Agreement") previously entered between you and Linden 13 * to you under the terms of the GNU General Public License, version 2.0
14 * Lab. By accessing, using, copying, modifying or distributing this 14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * software, you acknowledge that you have been informed of your 15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * obligations under the Agreement and agree to abide by those obligations. 16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
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
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 *
25 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above,
27 * and agree to abide by those obligations.
17 * 28 *
18 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 29 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
19 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 30 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
diff --git a/linden/indra/test/reflection_tut.cpp b/linden/indra/test/reflection_tut.cpp
index e39c10e..d49be85 100644
--- a/linden/indra/test/reflection_tut.cpp
+++ b/linden/indra/test/reflection_tut.cpp
@@ -18,7 +18,8 @@
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -30,7 +31,7 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#include <tut/tut.h> 34#include <tut/tut.hpp>
34 35
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
diff --git a/linden/indra/test/test.cpp b/linden/indra/test/test.cpp
index 10a2088..ba81c6e 100644
--- a/linden/indra/test/test.cpp
+++ b/linden/indra/test/test.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,
@@ -53,9 +54,10 @@
53# include "ctype_workaround.h" 54# include "ctype_workaround.h"
54#endif 55#endif
55 56
56
57namespace tut 57namespace tut
58{ 58{
59 std::string sSourceDir;
60
59 test_runner_singleton runner; 61 test_runner_singleton runner;
60} 62}
61 63
@@ -68,7 +70,6 @@ public:
68 mPassedTests(0), 70 mPassedTests(0),
69 mFailedTests(0), 71 mFailedTests(0),
70 mSkippedTests(0), 72 mSkippedTests(0),
71 mSkippedFailTests(0),
72 mStream(stream) 73 mStream(stream)
73 { 74 {
74 } 75 }
@@ -107,10 +108,6 @@ public:
107 break; 108 break;
108 case tut::test_result::skip: 109 case tut::test_result::skip:
109 ++mSkippedTests; 110 ++mSkippedTests;
110 out << "skipped";
111 break;
112 case tut::test_result::skip_fail:
113 ++mSkippedFailTests;
114 out << "skipped known failure"; 111 out << "skipped known failure";
115 break; 112 break;
116 default: 113 default:
@@ -159,12 +156,7 @@ private:
159 156
160 if (mSkippedTests > 0) 157 if (mSkippedTests > 0)
161 { 158 {
162 stream << "Skipped Tests: " << mSkippedTests << std::endl; 159 stream << "Skipped known failures: " << mSkippedTests
163 }
164
165 if (mSkippedFailTests > 0)
166 {
167 stream << "Skipped known failures: " << mSkippedFailTests
168 << std::endl; 160 << std::endl;
169 } 161 }
170 162
@@ -183,7 +175,6 @@ protected:
183 int mPassedTests; 175 int mPassedTests;
184 int mFailedTests; 176 int mFailedTests;
185 int mSkippedTests; 177 int mSkippedTests;
186 int mSkippedFailTests;
187 std::ostream *mStream; 178 std::ostream *mStream;
188}; 179};
189 180
@@ -194,7 +185,7 @@ static const apr_getopt_option_t TEST_CL_OPTIONS[] =
194 {"verbose", 'v', 0, "Verbose output."}, 185 {"verbose", 'v', 0, "Verbose output."},
195 {"group", 'g', 1, "Run test group specified by option argument."}, 186 {"group", 'g', 1, "Run test group specified by option argument."},
196 {"output", 'o', 1, "Write output to the named file."}, 187 {"output", 'o', 1, "Write output to the named file."},
197 {"skip", 's', 1, "Skip test number specified by option argument. Only works when a specific group is being tested"}, 188 {"sourcedir", 's', 1, "Project source file directory from CMake."},
198 {"touch", 't', 1, "Touch the given file if all tests succeed"}, 189 {"touch", 't', 1, "Touch the given file if all tests succeed"},
199 {"wait", 'w', 0, "Wait for input before exit."}, 190 {"wait", 'w', 0, "Wait for input before exit."},
200 {"debug", 'd', 0, "Emit full debug logs."}, 191 {"debug", 'd', 0, "Emit full debug logs."},
@@ -226,8 +217,6 @@ void stream_usage(std::ostream& s, const char* app)
226 s << "\tList all available test groups." << std::endl; 217 s << "\tList all available test groups." << std::endl;
227 s << " " << app << " --group=uuid" << std::endl; 218 s << " " << app << " --group=uuid" << std::endl;
228 s << "\tRun the test group 'uuid'." << std::endl; 219 s << "\tRun the test group 'uuid'." << std::endl;
229 s << " " << app << " --skip=2" << std::endl;
230 s << "\tSkip test case 2." << std::endl;
231} 220}
232 221
233void stream_groups(std::ostream& s, const char* app) 222void stream_groups(std::ostream& s, const char* app)
@@ -276,7 +265,6 @@ int main(int argc, char **argv)
276 // values used for controlling application 265 // values used for controlling application
277 bool verbose_mode = false; 266 bool verbose_mode = false;
278 bool wait_at_exit = false; 267 bool wait_at_exit = false;
279 int skip_test_id = 0;
280 std::string test_group; 268 std::string test_group;
281 269
282 // values use for options parsing 270 // values use for options parsing
@@ -302,9 +290,6 @@ int main(int argc, char **argv)
302 case 'g': 290 case 'g':
303 test_group.assign(opt_arg); 291 test_group.assign(opt_arg);
304 break; 292 break;
305 case 's':
306 skip_test_id = atoi(opt_arg);
307 break;
308 case 'h': 293 case 'h':
309 stream_usage(std::cout, argv[0]); 294 stream_usage(std::cout, argv[0]);
310 return 0; 295 return 0;
@@ -319,6 +304,11 @@ int main(int argc, char **argv)
319 output = new std::ofstream; 304 output = new std::ofstream;
320 output->open(opt_arg); 305 output->open(opt_arg);
321 break; 306 break;
307 case 's': // --sourcedir
308 tut::sSourceDir = opt_arg;
309 // For convenience, so you can use tut::sSourceDir + "myfile"
310 tut::sSourceDir += '/';
311 break;
322 case 't': 312 case 't':
323 touch = opt_arg; 313 touch = opt_arg;
324 break; 314 break;
@@ -347,7 +337,7 @@ int main(int argc, char **argv)
347 } 337 }
348 else 338 else
349 { 339 {
350 tut::runner.get().run_tests(test_group, skip_test_id); 340 tut::runner.get().run_tests(test_group);
351 } 341 }
352 342
353 if (wait_at_exit) 343 if (wait_at_exit)
diff --git a/linden/indra/test/test.h b/linden/indra/test/test.h
new file mode 100644
index 0000000..cee1851
--- /dev/null
+++ b/linden/indra/test/test.h
@@ -0,0 +1,50 @@
1/**
2 * @file test.h
3 * @author James
4 * @date 2009-01-12
5 *
6 * $LicenseInfo:firstyear=2009&license=viewergpl$
7 *
8 * Copyright (c) 2009, Linden Research, Inc.
9 *
10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 *
18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33#ifndef TEST_H
34#define TEST_H
35
36#include <string>
37
38namespace tut
39{
40 // Source code directory from CMake, used for loading test data and
41 // configuration. For example:
42 //
43 // loadMyConfig( sSourceDir + "config.dat" );
44 //
45 // Use sparingly, as hitting the file system slows down test execution
46 // and hence every compile. JC
47 extern std::string sSourceDir;
48}
49
50#endif
diff --git a/linden/indra/test/test_llmanifest.py b/linden/indra/test/test_llmanifest.py
index 6217e6a..e645c88 100644
--- a/linden/indra/test/test_llmanifest.py
+++ b/linden/indra/test/test_llmanifest.py
@@ -19,7 +19,8 @@ online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
19There are special exceptions to the terms and conditions of the GPL as 19There are special exceptions to the terms and conditions of the GPL as
20it is applied to this Source Code. View the full text of the exception 20it is applied to this Source Code. View the full text of the exception
21in the file doc/FLOSS-exception.txt in this software distribution, or 21in the file doc/FLOSS-exception.txt in this software distribution, or
22online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 22online at
23http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 24
24By copying, modifying or distributing this software, you acknowledge 25By copying, modifying or distributing this software, you acknowledge
25that you have read and understood your obligations described above, 26that you have read and understood your obligations described above,
diff --git a/linden/indra/test/v2math_tut.cpp b/linden/indra/test/v2math_tut.cpp
index da4b082..08a091a 100644
--- a/linden/indra/test/v2math_tut.cpp
+++ b/linden/indra/test/v2math_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35 36
36#include "linden_common.h" 37#include "linden_common.h"
37#include "lltut.h" 38#include "lltut.h"
diff --git a/linden/indra/test/v3color_tut.cpp b/linden/indra/test/v3color_tut.cpp
index 57ef9cc..26d3068 100644
--- a/linden/indra/test/v3color_tut.cpp
+++ b/linden/indra/test/v3color_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "v3color.h" 38#include "v3color.h"
@@ -59,7 +60,7 @@ namespace tut
59 const F32 vec[3] = {2.0f, 3.2f,1.f}; 60 const F32 vec[3] = {2.0f, 3.2f,1.f};
60 LLColor3 llcolor3b(vec); 61 LLColor3 llcolor3b(vec);
61 ensure("3:LLColor3:Fail to initialize " ,(2.0f == llcolor3b.mV[0]) && (3.2f == llcolor3b.mV[1]) && (1.f == llcolor3b.mV[2])); 62 ensure("3:LLColor3:Fail to initialize " ,(2.0f == llcolor3b.mV[0]) && (3.2f == llcolor3b.mV[1]) && (1.f == llcolor3b.mV[2]));
62 char* str = "561122"; 63 const char* str = "561122";
63 LLColor3 llcolor3c(str); 64 LLColor3 llcolor3c(str);
64 v1 = (F32)86.0f/255.0f; // 0x56 = 86 65 v1 = (F32)86.0f/255.0f; // 0x56 = 86
65 v2 = (F32)17.0f/255.0f; // 0x11 = 17 66 v2 = (F32)17.0f/255.0f; // 0x11 = 17
diff --git a/linden/indra/test/v3dmath_tut.cpp b/linden/indra/test/v3dmath_tut.cpp
index cf67498..598d72a 100644
--- a/linden/indra/test/v3dmath_tut.cpp
+++ b/linden/indra/test/v3dmath_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "llquaternion.h" 38#include "llquaternion.h"
@@ -510,7 +511,7 @@ namespace tut
510 void v3dmath_object::test<24>() 511 void v3dmath_object::test<24>()
511 { 512 {
512#if LL_WINDOWS && _MSC_VER < 1400 513#if LL_WINDOWS && _MSC_VER < 1400
513 skip_fail("This fails on VS2003!"); 514 skip("This fails on VS2003!");
514#else 515#else
515 F64 x = 10., y = 20., z = -15.; 516 F64 x = 10., y = 20., z = -15.;
516 F64 angle1, angle2; 517 F64 angle1, angle2;
diff --git a/linden/indra/test/v3math_tut.cpp b/linden/indra/test/v3math_tut.cpp
index 64e07a7..7cbcb23 100644
--- a/linden/indra/test/v3math_tut.cpp
+++ b/linden/indra/test/v3math_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "llquaternion.h" 38#include "llquaternion.h"
diff --git a/linden/indra/test/v4color_tut.cpp b/linden/indra/test/v4color_tut.cpp
index d08bb57..b9142e7 100644
--- a/linden/indra/test/v4color_tut.cpp
+++ b/linden/indra/test/v4color_tut.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,
@@ -32,7 +33,7 @@
32 */ 33 */
33 34
34 35
35#include <tut/tut.h> 36#include <tut/tut.hpp>
36#include "linden_common.h" 37#include "linden_common.h"
37#include "lltut.h" 38#include "lltut.h"
38#include "v4coloru.h" 39#include "v4coloru.h"
diff --git a/linden/indra/test/v4coloru_tut.cpp b/linden/indra/test/v4coloru_tut.cpp
index ddf1463..1630b4e 100644
--- a/linden/indra/test/v4coloru_tut.cpp
+++ b/linden/indra/test/v4coloru_tut.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,
@@ -32,7 +33,7 @@
32 */ 33 */
33 34
34 35
35#include <tut/tut.h> 36#include <tut/tut.hpp>
36#include "linden_common.h" 37#include "linden_common.h"
37#include "lltut.h" 38#include "lltut.h"
38#include "llsd.h" 39#include "llsd.h"
diff --git a/linden/indra/test/v4math_tut.cpp b/linden/indra/test/v4math_tut.cpp
index 946524a..cc37be3 100644
--- a/linden/indra/test/v4math_tut.cpp
+++ b/linden/indra/test/v4math_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "llquaternion.h" 38#include "llquaternion.h"
diff --git a/linden/indra/test/xform_tut.cpp b/linden/indra/test/xform_tut.cpp
index 8387696..55e70c1 100644
--- a/linden/indra/test/xform_tut.cpp
+++ b/linden/indra/test/xform_tut.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,
@@ -31,7 +32,7 @@
31 * $/LicenseInfo$ 32 * $/LicenseInfo$
32 */ 33 */
33 34
34#include <tut/tut.h> 35#include <tut/tut.hpp>
35#include "linden_common.h" 36#include "linden_common.h"
36#include "lltut.h" 37#include "lltut.h"
37#include "xform.h" 38#include "xform.h"