Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3-3.3.Test/UtilityTests.cs @ 17667

Last change on this file since 17667 was 17667, checked in by dleko, 4 years ago

#2825 Bugfix: The correct number of reference points are returned on ReferencePoint.GetNumberOfGeneratedReferencePoints.

File size: 1.1 KB
Line 
1using System;
2using HeuristicLab.Algorithms.NSGA3;
3using Microsoft.VisualStudio.TestTools.UnitTesting;
4
5namespace HeuristicLab.Algorithms.NSGA3_3._3.Test
6{
7    [TestClass]
8    public class UtilityTests
9    {
10        [DataTestMethod]
11        [DataRow(0, 1)]
12        [DataRow(1, 1)]
13        [DataRow(3, 6)]
14        [DataRow(4, 24)]
15        [DataRow(10, 3628800)]
16        [DataRow(12, 479001600)]
17        [DataRow(13, 6227020800)]
18        [DataRow(14, 87178291200)]
19        public void TestFactorial(int input, long result)
20        {
21            Assert.AreEqual(result, Utility.Factorial(input));
22        }
23
24        [DataTestMethod]
25        [DataRow(-1)]
26        [DataRow(31)]
27        public void TestFactorialConstraint(int input)
28        {
29            Assert.ThrowsException<InvalidOperationException>(() => { Utility.Factorial(input); });
30        }
31
32        [DataTestMethod]
33        [DataRow(14, 12, 91)]
34        public void TestNCR(int n, int r, int result)
35        {
36            Assert.AreEqual(result, Utility.NCR(n, r));
37        }
38    }
39}
Note: See TracBrowser for help on using the repository browser.