mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
Finished adding tests
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.mattrixwv.project_euler.problems;
|
||||
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
import org.junit.jupiter.api.Order;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
|
||||
import com.mattrixwv.project_euler.exceptions.Unsolved;
|
||||
|
||||
|
||||
public class TestProblem42 extends BaseTest{
|
||||
@InjectMocks
|
||||
private Problem42 problem;
|
||||
static{
|
||||
description = "Triangular number t(n) - (n * (n + 1)) / 2. For A = 1, B = 2, ... find the number of trinagular words in the file";
|
||||
result = "The number of triangular numbers is 162";
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@Override
|
||||
public void testDescription(){
|
||||
super.testDescription(problem);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@Override
|
||||
public void testSolve(){
|
||||
assertThrows(Unsolved.class, () -> { problem.getTriangularWords(); });
|
||||
assertThrows(Unsolved.class, () -> { problem.getNumberTriangularNumbers(); });
|
||||
|
||||
super.testSolve(problem);
|
||||
|
||||
//Verify result
|
||||
assertEquals(162, problem.getTriangularWords().size());
|
||||
assertEquals(162, problem.getNumberTriangularNumbers());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@Override
|
||||
public void testReset(){
|
||||
super.testReset(problem);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user