mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
Added new 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 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user