1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/**
* @file assembly_tut.cpp
* @brief Tests for lscript/lscript_execute_mono
*
* $LicenseInfo:firstyear=2007&license=internal$
*
* Copyright (c) 2007-2008, Linden Research, Inc.
*
* The following source code is PROPRIETARY AND CONFIDENTIAL. Use of
* this source code is governed by the Linden Lab Source Code Disclosure
* Agreement ("Agreement") previously entered between you and Linden
* Lab. By accessing, using, copying, modifying or distributing this
* software, you acknowledge that you have been informed of your
* obligations under the Agreement 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 "lltut.h"
#include "lscript_execute_mono/assembly.cpp"
#include <string>
#include <map>
namespace tut
{
struct assembly_data
{
};
typedef test_group<assembly_data> assembly_test;
typedef assembly_test::object assembly_object;
tut::assembly_test assembly("assembly");
// Create some random junk, its not important at the moment.
U8* createTestBuffer(U32 size)
{
U8* result = new U8[size];
memset(result, 0, size);
return result;
}
template<> template<>
void assembly_object::test<1>()
{
ensure("Assembly map not empty before creation", sAssemblyMap.empty());
{
U32 size = 10;
U8* buffer = createTestBuffer(size);
boost::intrusive_ptr<LLAssembly> assembly1 = LLAssembly::create("Assembly1",
buffer, size);
ensure("created assembly with ref count of 1",
assembly1->mRefCount == 1);
ensure("sAssemblyMap.size() == 1", sAssemblyMap.size() == 1);
size = 200;
buffer = createTestBuffer(size);
boost::intrusive_ptr<LLAssembly> assembly2 = LLAssembly::create("Assembly2",
buffer, size);
ensure("created second assembly with ref count == 1",
assembly2->mRefCount == 1);
ensure("sAssemblyMap.size() == 2", sAssemblyMap.size() == 2);
size = 10;
buffer = createTestBuffer(size);
boost::intrusive_ptr<LLAssembly> assembly3 = LLAssembly::create("Assembly1",
buffer, size);
ensure("created with ref count of 2",
assembly3->mRefCount == 2);
ensure("sAssemblyMap.size() == 2", sAssemblyMap.size() == 2);
}
ensure("Assembly map not empty after creation", sAssemblyMap.empty());
}
}
|