From 117e22047c5752352342d64e3fb7ce00a4eb8113 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:04 -0500 Subject: Second Life viewer sources 1.18.1.2 --- linden/indra/test/files.lst | 1 + linden/indra/test/llbuffer_tut.cpp | 2 + linden/indra/test/llhttpdate_tut.cpp | 92 ++++++++++++++++++++++ linden/indra/test/llmessagetemplateparser_tut.cpp | 1 + linden/indra/test/llpermissions_tut.cpp | 1 + linden/indra/test/llsdmessagereader_tut.cpp | 1 + linden/indra/test/llservicebuilder_tut.cpp | 17 ++++ linden/indra/test/lltemplatemessagebuilder_tut.cpp | 1 + linden/indra/test/lluri_tut.cpp | 12 +-- linden/indra/test/message_tut.cpp | 1 + linden/indra/test/test_llmanifest.py | 2 +- 11 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 linden/indra/test/llhttpdate_tut.cpp (limited to 'linden/indra/test') diff --git a/linden/indra/test/files.lst b/linden/indra/test/files.lst index 8063bfd..d923d8f 100644 --- a/linden/indra/test/files.lst +++ b/linden/indra/test/files.lst @@ -8,6 +8,7 @@ test/llbuffer_tut.cpp test/lldate_tut.cpp test/llerror_tut.cpp test/llhost_tut.cpp +test/llhttpdate_tut.cpp test/llhttpclient_tut.cpp test/llhttpnode_tut.cpp test/llinventoryparcel_tut.cpp diff --git a/linden/indra/test/llbuffer_tut.cpp b/linden/indra/test/llbuffer_tut.cpp index bf58abb..afe3133 100644 --- a/linden/indra/test/llbuffer_tut.cpp +++ b/linden/indra/test/llbuffer_tut.cpp @@ -31,8 +31,10 @@ #include #include "lltut.h" #include "llbuffer.h" +#include "llerror.h" #include "llmemtype.h" + namespace tut { struct buffer diff --git a/linden/indra/test/llhttpdate_tut.cpp b/linden/indra/test/llhttpdate_tut.cpp new file mode 100644 index 0000000..5279a81 --- /dev/null +++ b/linden/indra/test/llhttpdate_tut.cpp @@ -0,0 +1,92 @@ +/** + * @file llhttpdate_tut.cpp + * @author Kartic Krishnamurthy + * @date Wednesday, 18 Jul 2007 17:00:00 GMT :) + * + * Copyright (c) 2007-2007, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlife.com/developers/opensource/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at http://secondlife.com/developers/opensource/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + */ + +#include "linden_common.h" +#include "lltut.h" + +#include "lldate.h" +#include "llframetimer.h" + +#include +#include + +namespace tut +{ + struct httpdate_data + { + LLDate some_date; + }; + typedef test_group httpdate_test; + typedef httpdate_test::object httpdate_object; + tut::httpdate_test httpdate("httpdate"); + + template<> template<> + void httpdate_object::test<1>() + { + static std::string epoch_expected = "Thursday, 01 Jan 1970 00:00:00 GMT" ; + ensure("Check Epoch in RFC 1123", ( epoch_expected == some_date.asRFC1123())); + } + + template<> template<> + void httpdate_object::test<2>() + { + static std::string expected = "Wednesday, 18 Jul 2007 22:17:24 GMT" ; + some_date = LLDate(1184797044.037586); + ensure("Check some timestamp in RFC 1123", ( expected == some_date.asRFC1123())); + } + + // This test of course most generic.. runs off current time + template<> template<> + void httpdate_object::test<3>() + { + //F64 sometime = LLFrameTimer::getTotalSeconds(); + time_t sometime; + time(&sometime); + some_date = LLDate((F64) sometime); + struct tm result; + char expected[255], *actual; + + gmtime_r((time_t *)&sometime, &result); + /* + std::cout << " seconds: "<< result.tm_sec + << ", minutes: " << result.tm_min + << ", hours: " << result.tm_hour + << ", day of the month: " << result.tm_mday + << ", month: " << result.tm_mon + << ", year: " << result.tm_year + << ", day of the week: " << result.tm_wday + << ", day in the year: " << result.tm_yday + << ", DST: " << result.tm_isdst << std::endl; + */ + strftime(expected, 255, "%A, %d %h %Y %H:%M:%S GMT", &result); + actual = (char *) some_date.asRFC1123().c_str(); + // probably not a good idea to use strcmp but this is just a unit test + ensure("Current time in RFC 1123", (strcmp(expected, actual) == 0)); + } +} diff --git a/linden/indra/test/llmessagetemplateparser_tut.cpp b/linden/indra/test/llmessagetemplateparser_tut.cpp index 74b4c55..7e1f5a3 100644 --- a/linden/indra/test/llmessagetemplateparser_tut.cpp +++ b/linden/indra/test/llmessagetemplateparser_tut.cpp @@ -29,6 +29,7 @@ #include #include "lltut.h" +#include "linden_common.h" #include "llmessagetemplateparser.h" namespace tut diff --git a/linden/indra/test/llpermissions_tut.cpp b/linden/indra/test/llpermissions_tut.cpp index 0c9082b..3b2cee0 100644 --- a/linden/indra/test/llpermissions_tut.cpp +++ b/linden/indra/test/llpermissions_tut.cpp @@ -29,6 +29,7 @@ */ #include +#include "linden_common.h" #include "lltut.h" #include "message.h" #include "llpermissions.h" diff --git a/linden/indra/test/llsdmessagereader_tut.cpp b/linden/indra/test/llsdmessagereader_tut.cpp index 5b644d0..0dd8974 100755 --- a/linden/indra/test/llsdmessagereader_tut.cpp +++ b/linden/indra/test/llsdmessagereader_tut.cpp @@ -28,6 +28,7 @@ */ #include +#include "linden_common.h" #include "lltut.h" #include "message.h" diff --git a/linden/indra/test/llservicebuilder_tut.cpp b/linden/indra/test/llservicebuilder_tut.cpp index 762aa46..3b9d8b4 100644 --- a/linden/indra/test/llservicebuilder_tut.cpp +++ b/linden/indra/test/llservicebuilder_tut.cpp @@ -92,5 +92,22 @@ namespace tut std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest", data_map); ensure_equals("Replacement URL Creation for Non-existant Service", test_url , "/agent/{$agent-id}/name"); } + + template<> template<> + void ServiceBuilderTestObject::test<5>() + { + LLSD test_block; + test_block["service-builder"] = "/proc/{$proc}{%params}"; + mServiceBuilder.createServiceDefinition("ServiceBuilderTest", test_block["service-builder"]); + LLSD data_map; + data_map["proc"] = "do/something/useful"; + data_map["params"]["estate_id"] = 1; + data_map["params"]["query"] = "public"; + std::string test_url = mServiceBuilder.buildServiceURI("ServiceBuilderTest", data_map); + ensure_equals( + "two part URL Creation", + test_url , + "/proc/do/something/useful?estate_id=1&query=public"); + } } diff --git a/linden/indra/test/lltemplatemessagebuilder_tut.cpp b/linden/indra/test/lltemplatemessagebuilder_tut.cpp index d25e57e..5f58660 100644 --- a/linden/indra/test/lltemplatemessagebuilder_tut.cpp +++ b/linden/indra/test/lltemplatemessagebuilder_tut.cpp @@ -28,6 +28,7 @@ */ #include +#include "linden_common.h" #include "lltut.h" #include "llapr.h" diff --git a/linden/indra/test/lluri_tut.cpp b/linden/indra/test/lluri_tut.cpp index a08fe4e..b49f6dd 100644 --- a/linden/indra/test/lluri_tut.cpp +++ b/linden/indra/test/lluri_tut.cpp @@ -165,8 +165,8 @@ namespace tut query["123"] = "12"; query["abcd"] = "abc"; checkParts(LLURI::buildHTTP("host", path, query), - "http", "//host/x/123?123=12&abcd=abc&", - "host", "/x/123", "123=12&abcd=abc&"); + "http", "//host/x/123?123=12&abcd=abc", + "host", "/x/123", "123=12&abcd=abc"); } template<> template<> @@ -191,8 +191,8 @@ namespace tut query["123"] = "?&*#//"; query["**@&?//"] = "abc"; checkParts(LLURI::buildHTTP("host", path, query), - "http", "//host/x/123?**@&?//=abc&123=?&*#//&", - "host", "/x/123", "**@&?//=abc&123=?&*#//&"); + "http", "//host/x/123?**@&?//=abc&123=?&*#//", + "host", "/x/123", "**@&?//=abc&123=?&*#//"); } template<> template<> @@ -206,8 +206,8 @@ namespace tut query["123"] = "12"; query["abcd"] = "abc"; checkParts(LLURI::buildHTTP("hi123*33--}{:portstuffs", path, query), - "http", "//hi123*33--}{:portstuffs/x/123?123=12&abcd=abc&", - "hi123*33--}{:portstuffs", "/x/123", "123=12&abcd=abc&"); + "http", "//hi123*33--}{:portstuffs/x/123?123=12&abcd=abc", + "hi123*33--}{:portstuffs", "/x/123", "123=12&abcd=abc"); } template<> template<> diff --git a/linden/indra/test/message_tut.cpp b/linden/indra/test/message_tut.cpp index 366c2b4..3425315 100644 --- a/linden/indra/test/message_tut.cpp +++ b/linden/indra/test/message_tut.cpp @@ -28,6 +28,7 @@ */ #include +#include "linden_common.h" #include "lltut.h" #include "llapr.h" diff --git a/linden/indra/test/test_llmanifest.py b/linden/indra/test/test_llmanifest.py index f503cbe..8bfca24 100644 --- a/linden/indra/test/test_llmanifest.py +++ b/linden/indra/test/test_llmanifest.py @@ -26,7 +26,7 @@ # WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, # COMPLETENESS OR PERFORMANCE. -from indra import llmanifest +from indra.util import llmanifest import os.path import os import unittest -- cgit v1.1