summaryrefslogtreecommitdiff
path: root/tests/src/CoreMangLib/cti/system/double/doublenan.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/CoreMangLib/cti/system/double/doublenan.cs')
-rw-r--r--tests/src/CoreMangLib/cti/system/double/doublenan.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/src/CoreMangLib/cti/system/double/doublenan.cs b/tests/src/CoreMangLib/cti/system/double/doublenan.cs
new file mode 100644
index 0000000000..907b82cafd
--- /dev/null
+++ b/tests/src/CoreMangLib/cti/system/double/doublenan.cs
@@ -0,0 +1,63 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+using System;
+using System.Collections;
+
+/// <summary>
+/// NaN
+/// </summary>
+public class DoubleNaN
+{
+ public static int Main()
+ {
+ DoubleNaN test = new DoubleNaN();
+ TestLibrary.TestFramework.BeginTestCase("DoubleNaN");
+
+ if (test.RunTests())
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("PASS");
+ return 100;
+ }
+ else
+ {
+ TestLibrary.TestFramework.EndTestCase();
+ TestLibrary.TestFramework.LogInformation("FAIL");
+ return 0;
+ }
+ }
+
+ public bool RunTests()
+ {
+ bool retVal = true;
+
+ TestLibrary.TestFramework.LogInformation("[Positive]");
+ retVal = PosTest1() && retVal;
+
+ return retVal;
+ }
+
+ public bool PosTest1()
+ {
+ bool retVal = true;
+ TestLibrary.TestFramework.BeginScenario("PosTest1: Ensure NaN is not a number");
+
+ try
+ {
+ if (Double.IsNaN(Double.NaN) != true)
+ {
+ TestLibrary.TestFramework.LogError("001.1", "NaN is a number!");
+ retVal = false;
+ }
+ }
+ catch (Exception e)
+ {
+ TestLibrary.TestFramework.LogError("001.2", "Unexpected exception: " + e);
+ TestLibrary.TestFramework.LogInformation(e.StackTrace);
+ retVal = false;
+ }
+
+ return retVal;
+ }
+}