Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package com.example
  2.  
  3. import com.google.common.truth.Truth.assertThat
  4. import org.junit.Test
  5.  
  6. class ArrayLeftRotationTest {
  7.  
  8. @Test
  9. fun rotateOnce() {
  10. val input = listOf(1, 2, 3, 4, 5)
  11.  
  12. val rotated = ArrayLeftRotation.Companion.leftRotate(input, 1)
  13.  
  14. assertThat(rotated).isEqualTo(listOf(2, 3, 4, 5, 1))
  15. }
  16.  
  17. @Test
  18. fun rotateTwice() {
  19. val input = listOf(1, 2, 3, 4, 5)
  20.  
  21. val rotated = ArrayLeftRotation.Companion.leftRotate(input, 2)
  22.  
  23. assertThat(rotated).isEqualTo(listOf(3, 4, 5, 1, 2))
  24. }
  25.  
  26. @Test
  27. fun rotateEntireLengthOfList() {
  28. val input = listOf(1, 2, 3, 4, 5)
  29.  
  30. val rotated = ArrayLeftRotation.Companion.leftRotate(input, input.size)
  31.  
  32. assertThat(rotated).isEqualTo(input)
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement