Added new tests

This commit is contained in:
2022-12-06 23:02:54 -05:00
parent b4dc0aed37
commit 26a38fb9ea
14 changed files with 529 additions and 9 deletions

View File

@@ -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 TestProblem36 extends BaseTest{
@InjectMocks
private Problem36 problem;
static{
description = "Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.";
result = "The sum of all base 10 and base 2 palindromic numbers < 999999 is 872187";
}
@Test
@Order(1)
@Override
public void testDescription(){
super.testDescription(problem);
}
@Test
@Order(2)
@Override
public void testSolve(){
assertThrows(Unsolved.class, () -> { problem.getPalindromes(); });
assertThrows(Unsolved.class, () -> { problem.getSumOfPalindromes(); });
super.testSolve(problem);
//Verify result
assertEquals(19, problem.getPalindromes().size());
assertEquals(872187, problem.getSumOfPalindromes());
}
@Test
@Order(3)
@Override
public void testReset(){
super.testReset(problem);
}
}