28 using System.Collections.Generic;
29 using NUnit.Framework;
30 using OpenSim.Tests.Common;
31 using OpenSim.Region.ScriptEngine.Shared;
33 namespace OpenSim.
Region.ScriptEngine.Shared.Tests
38 private Dictionary<double, int> m_doubleIntSet;
39 private Dictionary<string, int> m_stringIntSet;
47 m_doubleIntSet =
new Dictionary<double, int>();
48 m_doubleIntSet.Add(2.0, 2);
49 m_doubleIntSet.Add(-2.0, -2);
50 m_doubleIntSet.Add(0.0, 0);
51 m_doubleIntSet.Add(1.0, 1);
52 m_doubleIntSet.Add(-1.0, -1);
53 m_doubleIntSet.Add(999999999.0, 999999999);
54 m_doubleIntSet.Add(-99999999.0, -99999999);
56 m_stringIntSet =
new Dictionary<string, int>();
57 m_stringIntSet.Add(
"2", 2);
58 m_stringIntSet.Add(
"-2", -2);
59 m_stringIntSet.Add(
"0", 0);
60 m_stringIntSet.Add(
"1", 1);
61 m_stringIntSet.Add(
"-1", -1);
62 m_stringIntSet.Add(
"123.9", 123);
63 m_stringIntSet.Add(
"999999999", 999999999);
64 m_stringIntSet.Add(
"-99999999", -99999999);
65 m_stringIntSet.Add(
"", 0);
66 m_stringIntSet.Add(
"aa", 0);
67 m_stringIntSet.Add(
"56foo", 56);
68 m_stringIntSet.Add(
"42", 42);
69 m_stringIntSet.Add(
"42 is the answer", 42);
70 m_stringIntSet.Add(
" 42", 42);
71 m_stringIntSet.Add(
"42,123,456", 42);
72 m_stringIntSet.Add(
"0xff", 255);
73 m_stringIntSet.Add(
"12345678900000", -1);
82 TestHelpers.InMethod();
86 foreach (KeyValuePair<double, int> number
in m_doubleIntSet)
89 Assert.AreEqual(testInteger.value, number.Value);
99 TestHelpers.InMethod();
103 foreach (KeyValuePair<string, int> number
in m_stringIntSet)
106 Assert.AreEqual(testInteger.value, number.Value);
116 TestHelpers.InMethod();
120 foreach (KeyValuePair<string, int> number
in m_stringIntSet)
123 Assert.AreEqual(testInteger.value, number.Value);
133 TestHelpers.InMethod();
137 testInteger = (1 == 0);
138 Assert.AreEqual(0, testInteger.value);
140 testInteger = (1 == 1);
141 Assert.AreEqual(1, testInteger.value);
144 Assert.AreEqual(0, testInteger.value);
147 Assert.AreEqual(1, testInteger.value);
void SetUpDataSets()
Sets up dictionaries and arrays used in the tests.
void TestImplicitCastBooleanToLSLInteger()
Tests boolean correctly cast implicitly to LSLInteger.
void TestExplicitCastStringToLSLInteger()
Tests string is correctly cast explicitly to LSLInteger.
void TestExplicitCastLSLStringToLSLInteger()
Tests LSLString is correctly cast explicitly to LSLInteger.
void TestExplicitCastLSLFloatToLSLInteger()
Tests LSLFloat is correctly cast explicitly to LSLInteger.
OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLInteger LSLInteger