aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Tests/DataTestUtil.cs
diff options
context:
space:
mode:
authorSean Dague2009-02-16 19:23:53 +0000
committerSean Dague2009-02-16 19:23:53 +0000
commitc7a08752c0d49a470534fcebcd13710f517b3d00 (patch)
tree15fc841c9aff09eacd956bb6e9370cb591f86d0e /OpenSim/Data/Tests/DataTestUtil.cs
parent* refactor: remove AssetCache field hanging off Scene (diff)
downloadopensim-SC_OLD-c7a08752c0d49a470534fcebcd13710f517b3d00.zip
opensim-SC_OLD-c7a08752c0d49a470534fcebcd13710f517b3d00.tar.gz
opensim-SC_OLD-c7a08752c0d49a470534fcebcd13710f517b3d00.tar.bz2
opensim-SC_OLD-c7a08752c0d49a470534fcebcd13710f517b3d00.tar.xz
line ending fixes and set native eol property
Diffstat (limited to 'OpenSim/Data/Tests/DataTestUtil.cs')
-rw-r--r--OpenSim/Data/Tests/DataTestUtil.cs124
1 files changed, 62 insertions, 62 deletions
diff --git a/OpenSim/Data/Tests/DataTestUtil.cs b/OpenSim/Data/Tests/DataTestUtil.cs
index 778772f..37d1443 100644
--- a/OpenSim/Data/Tests/DataTestUtil.cs
+++ b/OpenSim/Data/Tests/DataTestUtil.cs
@@ -1,62 +1,62 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4using OpenMetaverse; 4using OpenMetaverse;
5using NUnit.Framework; 5using NUnit.Framework;
6 6
7namespace OpenSim.Data.Tests 7namespace OpenSim.Data.Tests
8{ 8{
9 9
10 /// <summary> 10 /// <summary>
11 /// Shared constants and methods for database unit tests. 11 /// Shared constants and methods for database unit tests.
12 /// </summary> 12 /// </summary>
13 public class DataTestUtil 13 public class DataTestUtil
14 { 14 {
15 15
16 public const uint UNSIGNED_INTEGER_MIN = uint.MinValue; 16 public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
17 public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue / 2; // NHibernate does not support unsigned integer range. 17 public const uint UNSIGNED_INTEGER_MAX = uint.MaxValue / 2; // NHibernate does not support unsigned integer range.
18 18
19 public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue 19 public const int INTEGER_MIN = int.MinValue + 1; // Postgresql requires +1 to .NET int.MinValue
20 public const int INTEGER_MAX = int.MaxValue; 20 public const int INTEGER_MAX = int.MaxValue;
21 21
22 public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION); 22 public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION);
23 public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION); 23 public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION);
24 public const float FLOAT_ACCURATE = 1.234567890123456789012f; 24 public const float FLOAT_ACCURATE = 1.234567890123456789012f;
25 public const float FLOAT_PRECISSION = 1E-5f; // Native MySQL is severly limited with floating accuracy 25 public const float FLOAT_PRECISSION = 1E-5f; // Native MySQL is severly limited with floating accuracy
26 26
27 public const double DOUBLE_MIN = -1E52 * (1 - DOUBLE_PRECISSION); 27 public const double DOUBLE_MIN = -1E52 * (1 - DOUBLE_PRECISSION);
28 public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION); 28 public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION);
29 public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f; 29 public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f;
30 public const double DOUBLE_PRECISSION = 1E-14; // Native MySQL is severly limited with double accuracy 30 public const double DOUBLE_PRECISSION = 1E-14; // Native MySQL is severly limited with double accuracy
31 31
32 public const string STRING_MIN = ""; 32 public const string STRING_MIN = "";
33 public static string STRING_MAX(int length) 33 public static string STRING_MAX(int length)
34 { 34 {
35 StringBuilder stringBuilder = new StringBuilder(); 35 StringBuilder stringBuilder = new StringBuilder();
36 for (int i = 0; i < length; i++) 36 for (int i = 0; i < length; i++)
37 { 37 {
38 stringBuilder.Append(i % 10); 38 stringBuilder.Append(i % 10);
39 } 39 }
40 return stringBuilder.ToString(); 40 return stringBuilder.ToString();
41 } 41 }
42 42
43 public static UUID UUID_MIN = new UUID("00000000-0000-0000-0000-000000000000"); 43 public static UUID UUID_MIN = new UUID("00000000-0000-0000-0000-000000000000");
44 public static UUID UUID_MAX = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); 44 public static UUID UUID_MAX = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
45 45
46 public const bool BOOLEAN_MIN = false; 46 public const bool BOOLEAN_MIN = false;
47 public const bool BOOLEAN_MAX = true; 47 public const bool BOOLEAN_MAX = true;
48 48
49 public static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue) 49 public static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue)
50 { 50 {
51 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION); 51 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION);
52 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION); 52 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION);
53 } 53 }
54 54
55 public static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue) 55 public static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue)
56 { 56 {
57 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION); 57 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION);
58 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION); 58 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION);
59 } 59 }
60 60
61 } 61 }
62} 62}