Add boilerplate for root project

This commit is contained in:
Rui Hu
2024-03-12 17:20:38 +08:00
parent 7739296926
commit 494bd6ff76
2 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
package com.cleverthis.interview;
import com.cleverthis.interview.padlock.PadlockImpl;
import org.junit.jupiter.api.Test;
import java.util.Random;
import static org.junit.jupiter.api.Assertions.*;
/**
* This is a simple placeholder to show how unit test works.
* You can replace it with your own test.
*/
class SolutionTest {
private void solve(PadlockImpl padlock) {
new Solution().solve(padlock);
}
@Test
void verify(){
Random random = new Random();
PadlockImpl padlock = new PadlockImpl(random.nextInt(1, 8));
long startTime = System.currentTimeMillis();
solve(padlock);
long endTime = System.currentTimeMillis();
assertTrue(padlock.isPasscodeCorrect());
System.out.println("Time usage: " + (endTime - startTime) + "ms");
}
}