aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/test/assembly_tut.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-09-06 18:24:57 -0500
committerJacek Antonelli2008-09-06 18:25:07 -0500
commit798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch)
tree1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/test/assembly_tut.cpp
parentSecond Life viewer sources 1.20.15 (diff)
downloadmeta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2
meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz
Second Life viewer sources 1.21.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/test/assembly_tut.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/linden/indra/test/assembly_tut.cpp b/linden/indra/test/assembly_tut.cpp
new file mode 100644
index 0000000..0b5aeb6
--- /dev/null
+++ b/linden/indra/test/assembly_tut.cpp
@@ -0,0 +1,86 @@
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-2008, 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}