Template repo for RepoBee demo task-2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
820 B

3 years ago
  1. import org.junit.Test;
  2. import org.junit.Before;
  3. import static org.junit.Assert.*;
  4. import static org.hamcrest.MatcherAssert.assertThat;
  5. import static org.hamcrest.CoreMatchers.*;
  6. public class FiboTest {
  7. @Test
  8. public void correctlyGeneratesFirst10Numbers() {
  9. Fibo f = new Fibo();
  10. long[] expected = {0, 1, 1, 2, 3, 5, 8, 13, 21, 34};
  11. long[] actual = new long[10];
  12. for (int i = 0; i < 10; i++) {
  13. actual[i] = f.next();
  14. }
  15. assertThat(actual, equalTo(expected));
  16. }
  17. @Test
  18. public void correctlyGeneratesFiftiethNumber() {
  19. // note that the first number is counted as the 0th
  20. Fibo f = new Fibo();
  21. for (int i = 0; i < 50; i++) {
  22. f.next();
  23. }
  24. assertThat(f.next(), equalTo(12586269025l));
  25. }
  26. }