-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTests.cs
54 lines (49 loc) · 1.55 KB
/
Tests.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UnitConverter
{
class Tests
{
Ratios Ratios = new Ratios();
Convert Convert = new Convert();
double Tolerance = 0.000001;
public void test1()
{
if (Ratios.GetRatio("Meters", "Feet") == 3.28)
Console.Write("Test 1: SUCCESS!\n");
else
Console.Write("Test 1: FAILURE!\n");
}
public void test2()
{
if (Ratios.GetRatio("Milimeters", "Inches") == 0.039)
Console.Write("Test 2: SUCCESS!\n");
else
Console.Write("Test 2: FAILURE!\n");
}
public void test3()
{
if (Convert.MetricToImperial("Kilometers", "Miles", 1) - 0.62 <= Tolerance)
Console.Write("Test 3: SUCCESS!\n");
else
Console.Write("Test 3: FAILURE!\n");
}
public void test4()
{
if (Convert.MetricToImperial("Kilometers", "Feet", 6) - 19684.8 <= Tolerance)
Console.Write("Test 4: SUCCESS!\n");
else
Console.Write("Test 4: FAILURE!\n");
}
public void test5()
{
// Back and Forth testing
if (Convert.MetricToImperial("Kilometers", "Feet", Convert.ImperialToMetric("Feet", "Kilometers", 1337)) == 1337)
Console.Write("Test 5: SUCCESS!\n");
else
Console.Write("Test 5: FAILURE!\n");
}
}
}