maddiebaka 8386ace107 Project architecture and naive solver solution
Set up project architecture interfaces and add a naive implementation
of a solver in DumbBruteSolver
2024-03-26 16:26:51 -04:00

31 lines
743 B
Java

package com.cleverthis.interview;
import com.cleverthis.interview.padlock.PadlockImpl;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* This is a base class for verifying the correctness of the solution.
*/
public abstract class SolutionTestBase {
/**
* Implement your solution in this function.
* */
protected abstract void solve(PadlockAdapter padlock);
protected void verify(int numpadSize) {
PadlockAdapter padlock = new PadlockJavaAdapter(numpadSize);
solve(padlock);
assertTrue(padlock.isPasscodeCorrect());
}
@Test
void verify1to7() {
for (int i = 1; i <= 7; i++) {
verify(i);
}
}
}