summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/CMakeLists.txt1
-rw-r--r--indra/llprimitive/llmaterialtable.cpp3
-rw-r--r--indra/llprimitive/llmaterialtable.h83
-rw-r--r--indra/llprimitive/llmediaentry.cpp9
-rw-r--r--indra/llprimitive/llprimitive.cpp1
-rw-r--r--indra/llprimitive/material_codes.cpp46
-rw-r--r--indra/llprimitive/material_codes.h19
-rw-r--r--indra/llprimitive/tests/llmediaentry_test.cpp231
8 files changed, 228 insertions, 165 deletions
diff --git a/indra/llprimitive/CMakeLists.txt b/indra/llprimitive/CMakeLists.txt
index d130513637..68a3d54597 100644
--- a/indra/llprimitive/CMakeLists.txt
+++ b/indra/llprimitive/CMakeLists.txt
@@ -25,6 +25,7 @@ set(llprimitive_SOURCE_FILES
lltreeparams.cpp
llvolumemessage.cpp
llvolumexml.cpp
+ material_codes.cpp
)
set(llprimitive_HEADER_FILES
diff --git a/indra/llprimitive/llmaterialtable.cpp b/indra/llprimitive/llmaterialtable.cpp
index 18787c47c5..774a58c8ac 100644
--- a/indra/llprimitive/llmaterialtable.cpp
+++ b/indra/llprimitive/llmaterialtable.cpp
@@ -92,6 +92,9 @@ F32 const LLMaterialTable::DEFAULT_FRICTION = 0.5f;
F32 const LLMaterialTable::DEFAULT_RESTITUTION = 0.4f;
LLMaterialTable::LLMaterialTable()
+ : mCollisionSoundMatrix(NULL),
+ mSlidingSoundMatrix(NULL),
+ mRollingSoundMatrix(NULL)
{
}
diff --git a/indra/llprimitive/llmaterialtable.h b/indra/llprimitive/llmaterialtable.h
index 2c0b046fa7..77f29a8e06 100644
--- a/indra/llprimitive/llmaterialtable.h
+++ b/indra/llprimitive/llmaterialtable.h
@@ -38,6 +38,8 @@
#include <list>
+class LLMaterialInfo;
+
const U32 LLMATERIAL_INFO_NAME_LENGTH = 256;
// We've moved toward more reasonable mass values for the Havok4 engine.
@@ -64,45 +66,6 @@ const F32 LEGACY_DEFAULT_OBJECT_DENSITY = 10.0f;
const F32 DEFAULT_AVATAR_DENSITY = 445.3f; // was 444.24f;
-class LLMaterialInfo
-{
-public:
- U8 mMCode;
- std::string mName;
- LLUUID mDefaultTextureID;
- LLUUID mShatterSoundID;
- F32 mDensity; // kg/m^3
- F32 mFriction;
- F32 mRestitution;
-
- // damage and energy constants
- F32 mHPModifier; // modifier on mass based HP total
- F32 mDamageModifier; // modifier on KE based damage
- F32 mEPModifier; // modifier on mass based EP total
-
- LLMaterialInfo(U8 mcode, const std::string& name, const LLUUID &uuid)
- {
- init(mcode,name,uuid);
- };
-
- void init(U8 mcode, const std::string& name, const LLUUID &uuid)
- {
- mDensity = 1000.f; // default to 1000.0 (water)
- mHPModifier = 1.f;
- mDamageModifier = 1.f;
- mEPModifier = 1.f;
-
- mMCode = mcode;
- mName = name;
- mDefaultTextureID = uuid;
- };
-
- ~LLMaterialInfo()
- {
- };
-
-};
-
class LLMaterialTable
{
public:
@@ -185,5 +148,47 @@ public:
static LLMaterialTable basic;
};
+
+class LLMaterialInfo
+{
+public:
+ U8 mMCode;
+ std::string mName;
+ LLUUID mDefaultTextureID;
+ LLUUID mShatterSoundID;
+ F32 mDensity; // kg/m^3
+ F32 mFriction;
+ F32 mRestitution;
+
+ // damage and energy constants
+ F32 mHPModifier; // modifier on mass based HP total
+ F32 mDamageModifier; // modifier on KE based damage
+ F32 mEPModifier; // modifier on mass based EP total
+
+ LLMaterialInfo(U8 mcode, const std::string& name, const LLUUID &uuid)
+ {
+ init(mcode,name,uuid);
+ };
+
+ void init(U8 mcode, const std::string& name, const LLUUID &uuid)
+ {
+ mDensity = 1000.f; // default to 1000.0 (water)
+ mFriction = LLMaterialTable::DEFAULT_FRICTION;
+ mRestitution = LLMaterialTable::DEFAULT_RESTITUTION;
+ mHPModifier = 1.f;
+ mDamageModifier = 1.f;
+ mEPModifier = 1.f;
+
+ mMCode = mcode;
+ mName = name;
+ mDefaultTextureID = uuid;
+ };
+
+ ~LLMaterialInfo()
+ {
+ };
+
+};
+
#endif
diff --git a/indra/llprimitive/llmediaentry.cpp b/indra/llprimitive/llmediaentry.cpp
index fa04bf80e7..2fc1e5e60c 100644
--- a/indra/llprimitive/llmediaentry.cpp
+++ b/indra/llprimitive/llmediaentry.cpp
@@ -164,6 +164,7 @@ void LLMediaEntry::asLLSD(LLSD& sd) const
// "security" fields
sd[WHITELIST_ENABLE_KEY] = mWhiteListEnable;
+ sd.erase(WHITELIST_KEY);
for (U32 i=0; i<mWhiteList.size(); i++)
{
sd[WHITELIST_KEY].append(mWhiteList[i]);
@@ -388,8 +389,12 @@ U32 LLMediaEntry::setWhiteList( const std::vector<std::string> &whitelist )
U32 LLMediaEntry::setWhiteList( const LLSD &whitelist )
{
- // If whitelist is undef, this is a no-op.
- if (whitelist.isUndefined()) return LSL_STATUS_OK;
+ // If whitelist is undef, the whitelist is cleared
+ if (whitelist.isUndefined())
+ {
+ mWhiteList.clear();
+ return LSL_STATUS_OK;
+ }
// However, if the whitelist is an empty array, erase it.
if (whitelist.isArray())
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 5ad758072c..b75d1b0f67 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -154,6 +154,7 @@ bool LLPrimitive::cleanupVolumeManager()
//===============================================================
LLPrimitive::LLPrimitive()
: mTextureList(),
+ mNumTEs(0),
mMiscFlags(0)
{
mPrimitiveCode = 0;
diff --git a/indra/llprimitive/material_codes.cpp b/indra/llprimitive/material_codes.cpp
new file mode 100644
index 0000000000..ce146dad8a
--- /dev/null
+++ b/indra/llprimitive/material_codes.cpp
@@ -0,0 +1,46 @@
+/**
+ * @file material_codes.cpp
+ * @brief Material_codes definitions
+ *
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ *
+ * Copyright (c) 2000-2009, 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://secondlifegrid.net/programs/open_source/licensing/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://secondlifegrid.net/programs/open_source/licensing/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.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+#include "material_codes.h"
+
+#include "lluuid.h"
+
+const LLUUID LL_DEFAULT_STONE_UUID("87c5765b-aa26-43eb-b8c6-c09a1ca6208e");
+const LLUUID LL_DEFAULT_METAL_UUID("6f3c53e9-ba60-4010-8f3e-30f51a762476");
+const LLUUID LL_DEFAULT_GLASS_UUID("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d");
+const LLUUID LL_DEFAULT_WOOD_UUID("89556747-24cb-43ed-920b-47caed15465f");
+const LLUUID LL_DEFAULT_FLESH_UUID("80736669-e4b9-450e-8890-d5169f988a50");
+const LLUUID LL_DEFAULT_PLASTIC_UUID("304fcb4e-7d33-4339-ba80-76d3d22dc11a");
+const LLUUID LL_DEFAULT_RUBBER_UUID("9fae0bc5-666d-477e-9f70-84e8556ec867");
+const LLUUID LL_DEFAULT_LIGHT_UUID("00000000-0000-0000-0000-000000000000");
diff --git a/indra/llprimitive/material_codes.h b/indra/llprimitive/material_codes.h
index e5a59a2789..ba3faba39f 100644
--- a/indra/llprimitive/material_codes.h
+++ b/indra/llprimitive/material_codes.h
@@ -33,7 +33,7 @@
#ifndef LL_MATERIAL_CODES_H
#define LL_MATERIAL_CODES_H
-#include "lluuid.h"
+class LLUUID;
// material types
const U8 LL_MCODE_STONE = 0;
@@ -47,13 +47,14 @@ const U8 LL_MCODE_LIGHT = 7;
const U8 LL_MCODE_END = 8;
const U8 LL_MCODE_MASK = 0x0F;
-const LLUUID LL_DEFAULT_STONE_UUID("87c5765b-aa26-43eb-b8c6-c09a1ca6208e");
-const LLUUID LL_DEFAULT_METAL_UUID("6f3c53e9-ba60-4010-8f3e-30f51a762476");
-const LLUUID LL_DEFAULT_GLASS_UUID("b4ba225c-373f-446d-9f7e-6cb7b5cf9b3d");
-const LLUUID LL_DEFAULT_WOOD_UUID("89556747-24cb-43ed-920b-47caed15465f");
-const LLUUID LL_DEFAULT_FLESH_UUID("80736669-e4b9-450e-8890-d5169f988a50");
-const LLUUID LL_DEFAULT_PLASTIC_UUID("304fcb4e-7d33-4339-ba80-76d3d22dc11a");
-const LLUUID LL_DEFAULT_RUBBER_UUID("9fae0bc5-666d-477e-9f70-84e8556ec867");
-const LLUUID LL_DEFAULT_LIGHT_UUID("00000000-0000-0000-0000-000000000000");
+// *NOTE: Define these in .cpp file to reduce duplicate instances
+extern const LLUUID LL_DEFAULT_STONE_UUID;
+extern const LLUUID LL_DEFAULT_METAL_UUID;
+extern const LLUUID LL_DEFAULT_GLASS_UUID;
+extern const LLUUID LL_DEFAULT_WOOD_UUID;
+extern const LLUUID LL_DEFAULT_FLESH_UUID;
+extern const LLUUID LL_DEFAULT_PLASTIC_UUID;
+extern const LLUUID LL_DEFAULT_RUBBER_UUID;
+extern const LLUUID LL_DEFAULT_LIGHT_UUID;
#endif
diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp
index 9ce6560923..88cd96ebe4 100644
--- a/indra/llprimitive/tests/llmediaentry_test.cpp
+++ b/indra/llprimitive/tests/llmediaentry_test.cpp
@@ -9,7 +9,14 @@
#include "linden_common.h"
#include "lltut.h"
-#include "boost/lexical_cast.hpp"
+#if LL_WINDOWS
+#pragma warning (push)
+#pragma warning (disable : 4702) // boost::lexical_cast generates this warning
+#endif
+#include <boost/lexical_cast.hpp>
+#if LL_WINDOWS
+#pragma warning (pop)
+#endif
#include "llstring.h"
#include "llsdutil.h"
#include "llsdserialize.h"
@@ -150,14 +157,9 @@ namespace
namespace tut
{
- bool llsd_equals(const LLSD& a, const LLSD& b) {
- // cheesy, brute force, but it works
- return std::string(ll_pretty_print_sd(a)) == std::string(ll_pretty_print_sd(b));
- }
-
void ensure_llsd_equals(const std::string& msg, const LLSD& expected, const LLSD& actual)
{
- if (!tut::llsd_equals(expected, actual))
+ if (!llsd_equals(expected, actual))
{
std::string message = msg;
message += ": actual: ";
@@ -190,9 +192,9 @@ namespace tut
entry.setWhiteList(tokens);
}
- void whitelist_test(bool enable, const char *whitelist, const char *candidate_url, bool expected_pass)
+ void whitelist_test(int num, bool enable, const char *whitelist, const char *candidate_url, bool expected_pass)
{
- std::string message = "Whitelist test";
+ std::string message = "Whitelist test " + boost::lexical_cast<std::string>(num);
LLMediaEntry entry;
entry.setWhiteListEnable(enable);
set_whitelist(entry, whitelist);
@@ -209,13 +211,13 @@ namespace tut
ensure(message, expected_pass == passed_whitelist);
}
- void whitelist_test(const char *whitelist, const char *candidate_url, bool expected_pass)
+ void whitelist_test(int num, const char *whitelist, const char *candidate_url, bool expected_pass)
{
- whitelist_test(true, whitelist, candidate_url, expected_pass);
+ whitelist_test(num, true, whitelist, candidate_url, expected_pass);
}
- void whitelist_test(const char *whitelist, const char *candidate_url)
+ void whitelist_test(int num, const char *whitelist, const char *candidate_url)
{
- whitelist_test(true, whitelist, candidate_url, true);
+ whitelist_test(num, true, whitelist, candidate_url, true);
}
template<> template<>
@@ -223,8 +225,7 @@ namespace tut
{
set_test_name("Test LLMediaEntry Instantiation");
LLMediaEntry entry;
- ensure_llsd_equals(get_test_name(), defaultMediaEntryLLSD, entry.asLLSD());
-
+ ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, entry.asLLSD());
}
template<> template<>
@@ -251,12 +252,45 @@ namespace tut
ensure_llsd_equals(get_test_name() + " failed", golden, entry.asLLSD());
}
+ template<> template<>
+ void object::test<4>()
+ {
+ set_test_name("Test LLMediaEntry::asLLSD()");
+ LLMediaEntry entry;
+ LLSD sd;
+ // Put some cruft in the LLSD
+ sd[LLMediaEntry::CURRENT_URL_KEY] = "http://www.example.com";
+ LLSD whitelist;
+ whitelist.append("*.example.com");
+ sd[LLMediaEntry::WHITELIST_KEY] = whitelist;
+ entry.asLLSD(sd);
+ ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, sd);
+ }
+
+
+ template<> template<>
+ void object::test<5>()
+ {
+ set_test_name("Test LLMediaEntry::asLLSD() -> LLMediaEntry::fromLLSD()");
+ LLMediaEntry entry1, entry2;
+ // Add a whitelist to entry2
+ std::vector<std::string> whitelist;
+ whitelist.push_back("*.example.com");
+ entry2.setWhiteList(whitelist);
+ // Render entry1 (which has no whitelist) as an LLSD
+ LLSD sd;
+ entry1.asLLSD(sd);
+ // "read" that LLSD into entry 2
+ entry2.fromLLSD(sd);
+ ensure_llsd_equals(get_test_name() + " failed", defaultMediaEntryLLSD, entry2.asLLSD());
+ }
+
// limit tests
const char *URL_OK = "http://www.example.com";
const char *URL_TOO_BIG = "http://www.example.com.qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";
template<> template<>
- void object::test<4>()
+ void object::test<6>()
{
set_test_name("Test Limits on setting current URL");
LLMediaEntry entry;
@@ -267,7 +301,7 @@ namespace tut
}
template<> template<>
- void object::test<5>()
+ void object::test<7>()
{
set_test_name("Test Limits on setting home URL");
LLMediaEntry entry;
@@ -278,7 +312,7 @@ namespace tut
}
template<> template<>
- void object::test<6>()
+ void object::test<8>()
{
set_test_name("Test Limits on setting whitelist");
@@ -292,7 +326,7 @@ namespace tut
}
template<> template<>
- void object::test<7>()
+ void object::test<9>()
{
set_test_name("Test Limits on setting whitelist too big");
@@ -307,7 +341,7 @@ namespace tut
}
template<> template<>
- void object::test<8>()
+ void object::test<10>()
{
set_test_name("Test Limits on setting whitelist too many");
@@ -323,7 +357,7 @@ namespace tut
}
template<> template<>
- void object::test<9>()
+ void object::test<11>()
{
set_test_name("Test to make sure both setWhiteList() functions behave the same");
@@ -341,7 +375,7 @@ namespace tut
}
template<> template<>
- void object::test<10>()
+ void object::test<12>()
{
set_test_name("Test to make sure both setWhiteList() functions behave the same");
@@ -362,7 +396,7 @@ namespace tut
}
template<> template<>
- void object::test<11>()
+ void object::test<13>()
{
set_test_name("Test to make sure both setWhiteList() functions behave the same");
@@ -382,103 +416,70 @@ namespace tut
empty == entry2.getWhiteList());
}
- // Whitelist check tests
-
- // Check the "empty whitelist" case
template<> template<>
- void object::test<12>() { whitelist_test("", "http://www.example.com", true); }
+ void object::test<14>()
+ {
+ // Whitelist check tests
+ int n=0;
+
+ // Check the "empty whitelist" case
+ whitelist_test(++n, "", "http://www.example.com", true);
- // Check the "missing scheme" case
- template<> template<>
- void object::test<13>() { whitelist_test("www.example.com", "http://www.example.com", true); }
+ // Check the "missing scheme" case
+ whitelist_test(++n, "www.example.com", "http://www.example.com", true);
- // Check the "exactly the same" case
- template<> template<>
- void object::test<14>() { whitelist_test("http://example.com", "http://example.com", true); }
+ // Check the "exactly the same" case
+ whitelist_test(++n, "http://example.com", "http://example.com", true);
- // Check the enable flag
- template<> template<>
- void object::test<15>() { whitelist_test(false, "www.example.com", "http://www.secondlife.com", true); }
- template<> template<>
- void object::test<16>() { whitelist_test(true, "www.example.com", "http://www.secondlife.com", false); }
+ // Check the enable flag
+ whitelist_test(++n, false, "www.example.com", "http://www.secondlife.com", true);
+ whitelist_test(++n, true, "www.example.com", "http://www.secondlife.com", false);
- // Check permutations of trailing slash:
- template<> template<>
- void object::test<17>() { whitelist_test("http://www.example.com", "http://www.example.com/", true); }
- template<> template<>
- void object::test<18>() { whitelist_test("http://www.example.com/", "http://www.example.com/", true); }
- template<> template<>
- void object::test<19>() { whitelist_test("http://www.example.com/", "http://www.example.com", false); }
- template<> template<>
- void object::test<20>() { whitelist_test("http://www.example.com", "http://www.example.com/foobar", true); }
- template<> template<>
- void object::test<21>() { whitelist_test("http://www.example.com/", "http://www.example.com/foobar", false); }
+ // Check permutations of trailing slash:
+ whitelist_test(++n, "http://www.example.com", "http://www.example.com/", true);
+ whitelist_test(++n, "http://www.example.com/", "http://www.example.com/", true);
+ whitelist_test(++n, "http://www.example.com/", "http://www.example.com", false);
+ whitelist_test(++n, "http://www.example.com", "http://www.example.com/foobar", true);
+ whitelist_test(++n, "http://www.example.com/", "http://www.example.com/foobar", false);
- // More cases...
- template<> template<>
- void object::test<22>() { whitelist_test("http://example.com", "http://example.com/wiki", true); }
- template<> template<>
- void object::test<23>() { whitelist_test("www.example.com", "http://www.example.com/help", true); }
- template<> template<>
- void object::test<24>() { whitelist_test("http://www.example.com", "http://wwwexample.com", false); }
- template<> template<>
- void object::test<25>() { whitelist_test("http://www.example.com", "http://www.example.com/wiki", true); }
- template<> template<>
- void object::test<26>() { whitelist_test("example.com", "http://wwwexample.com", false); }
- template<> template<>
- void object::test<27>() { whitelist_test("http://www.example.com/", "http://www.amazon.com/wiki", false); }
- template<> template<>
- void object::test<28>() { whitelist_test("www.example.com", "http://www.amazon.com", false); }
-
- // regexp cases
- template<> template<>
- void object::test<29>() { whitelist_test("*.example.com", "http://www.example.com", true); }
- template<> template<>
- void object::test<30>() { whitelist_test("*.example.com", "http://www.amazon.com", false); }
- template<> template<>
- void object::test<31>() { whitelist_test("*.example.com", "http://www.example.com/foo/bar", true); }
- template<> template<>
- void object::test<32>() { whitelist_test("*.example.com", "http:/example.com/foo/bar", false); }
- template<> template<>
- void object::test<33>() { whitelist_test("*example.com", "http://example.com/foo/bar", true); }
- template<> template<>
- void object::test<34>() { whitelist_test("*example.com", "http://my.virus.com/foo/bar?example.com", false); }
- template<> template<>
- void object::test<35>() { whitelist_test("example.com", "http://my.virus.com/foo/bar?example.com", false); }
- template<> template<>
- void object::test<36>() { whitelist_test("*example.com", "http://my.virus.com/foo/bar?*example.com", false); }
- template<> template<>
- void object::test<37>() { whitelist_test("http://*example.com", "http://www.example.com", true); }
- template<> template<>
- void object::test<38>() { whitelist_test("http://*.example.com", "http://www.example.com", true); }
- template<> template<>
- void object::test<39>() { whitelist_test("http://*.e$?^.com", "http://www.e$?^.com", true); }
- template<> template<>
- void object::test<40>() { whitelist_test("*.example.com/foo/bar", "http://www.example.com/", false); }
- template<> template<>
- void object::test<41>() { whitelist_test("*.example.com/foo/bar", "http://example.com/foo/bar", false); }
- template<> template<>
- void object::test<42>() { whitelist_test("http://*.example.com/foo/bar", "http://www.example.com", false); }
- template<> template<>
- void object::test<43>() { whitelist_test("http://*.example.com", "https://www.example.com", false); }
- template<> template<>
- void object::test<44>() { whitelist_test("http*://*.example.com", "rtsp://www.example.com", false); }
- template<> template<>
- void object::test<45>() { whitelist_test("http*://*.example.com", "https://www.example.com", true); }
- template<> template<>
- void object::test<46>() { whitelist_test("example.com", "http://www.example.com", false); }
- template<> template<>
- void object::test<47>() { whitelist_test("www.example.com", "http://www.example.com:80", false); }
- template<> template<>
- void object::test<48>() { whitelist_test("www.example.com", "http://www.example.com", true); }
- template<> template<>
- void object::test<49>() { whitelist_test("www.example.com/", "http://www.example.com", false); }
- template<> template<>
- void object::test<50>() { whitelist_test("www.example.com/foo/bar/*", "http://www.example.com/foo/bar/baz", true); }
- // Path only
- template<> template<>
- void object::test<51>() { whitelist_test("/foo/*/baz", "http://www.example.com/foo/bar/baz", true); }
- template<> template<>
- void object::test<52>() { whitelist_test("/foo/*/baz", "http://www.example.com/foo/bar/", false); }
+ // More cases...
+ whitelist_test(++n, "http://example.com", "http://example.com/wiki", true);
+ whitelist_test(++n, "www.example.com", "http://www.example.com/help", true);
+ whitelist_test(++n, "http://www.example.com", "http://wwwexample.com", false);
+ whitelist_test(++n, "http://www.example.com", "http://www.example.com/wiki", true);
+ whitelist_test(++n, "example.com", "http://wwwexample.com", false);
+ whitelist_test(++n, "http://www.example.com/", "http://www.amazon.com/wiki", false);
+ whitelist_test(++n, "www.example.com", "http://www.amazon.com", false);
+
+ // regexp cases
+ whitelist_test(++n, "*.example.com", "http://www.example.com", true);
+ whitelist_test(++n, "*.example.com", "http://www.amazon.com", false);
+ whitelist_test(++n, "*.example.com", "http://www.example.com/foo/bar", true);
+ whitelist_test(++n, "*.example.com", "http:/example.com/foo/bar", false);
+ whitelist_test(++n, "*example.com", "http://example.com/foo/bar", true);
+ whitelist_test(++n, "*example.com", "http://my.virus.com/foo/bar?example.com", false);
+ whitelist_test(++n, "example.com", "http://my.virus.com/foo/bar?example.com", false);
+ whitelist_test(++n, "*example.com", "http://my.virus.com/foo/bar?*example.com", false);
+ whitelist_test(++n, "http://*example.com", "http://www.example.com", true);
+ whitelist_test(++n, "http://*.example.com", "http://www.example.com", true);
+ whitelist_test(++n, "http://*.e$?^.com", "http://www.e$?^.com", true);
+ whitelist_test(++n, "*.example.com/foo/bar", "http://www.example.com/", false);
+ whitelist_test(++n, "*.example.com/foo/bar", "http://example.com/foo/bar", false);
+ whitelist_test(++n, "http://*.example.com/foo/bar", "http://www.example.com", false);
+ whitelist_test(++n, "http://*.example.com", "https://www.example.com", false);
+ whitelist_test(++n, "http*://*.example.com", "rtsp://www.example.com", false);
+ whitelist_test(++n, "http*://*.example.com", "https://www.example.com", true);
+ whitelist_test(++n, "example.com", "http://www.example.com", false);
+ whitelist_test(++n, "www.example.com", "http://www.example.com:80", false);
+ whitelist_test(++n, "www.example.com", "http://www.example.com", true);
+ whitelist_test(++n, "www.example.com/", "http://www.example.com", false);
+ whitelist_test(++n, "www.example.com/foo/bar/*", "http://www.example.com/foo/bar/baz", true);
+
+ // Path only
+ whitelist_test(++n, "/foo/*/baz", "http://www.example.com/foo/bar/baz", true);
+ whitelist_test(++n, "/foo/*/baz", "http://www.example.com/foo/bar/", false);
+ }
+
}
+