29 using System.Collections.Generic;
32 using NUnit.Framework;
34 namespace OpenSim.Data.Tests
41 public const uint UNSIGNED_INTEGER_MIN = uint.MinValue;
43 public const uint UNSIGNED_INTEGER_MAX = INTEGER_MAX;
45 public const int INTEGER_MIN = int.MinValue + 1;
46 public const int INTEGER_MAX = int.MaxValue;
48 public const float FLOAT_MIN = float.MinValue * (1 - FLOAT_PRECISSION);
49 public const float FLOAT_MAX = float.MaxValue * (1 - FLOAT_PRECISSION);
50 public const float FLOAT_ACCURATE = 1.234567890123456789012f;
51 public const float FLOAT_PRECISSION = 1E-5f;
53 public const double DOUBLE_MIN = -1E52 * (1 - DOUBLE_PRECISSION);
54 public const double DOUBLE_MAX = 1E52 * (1 - DOUBLE_PRECISSION);
55 public const double DOUBLE_ACCURATE = 1.2345678901234567890123456789012345678901234567890123f;
56 public const double DOUBLE_PRECISSION = 1E-14;
58 public const string STRING_MIN =
"";
61 StringBuilder stringBuilder =
new StringBuilder();
62 for (
int i = 0; i < length; i++)
64 stringBuilder.Append(i % 10);
66 return stringBuilder.ToString();
69 public static UUID UUID_MIN =
new UUID(
"00000000-0000-0000-0000-000000000000");
70 public static UUID UUID_MAX =
new UUID(
"ffffffff-ffff-ffff-ffff-ffffffffffff");
72 public const bool BOOLEAN_MIN =
false;
73 public const bool BOOLEAN_MAX =
true;
77 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * FLOAT_PRECISSION);
78 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * FLOAT_PRECISSION);
83 Assert.GreaterOrEqual(actualValue, expectedValue - Math.Abs(expectedValue) * DOUBLE_PRECISSION);
84 Assert.LessOrEqual(actualValue, expectedValue + Math.Abs(expectedValue) * DOUBLE_PRECISSION);
static void AssertDoubleEqualsWithTolerance(double expectedValue, double actualValue)
static string STRING_MAX(int length)
Shared constants and methods for database unit tests.
static void AssertFloatEqualsWithTolerance(float expectedValue, float actualValue)