From 0a5ee18079fddf0a1a4669a59b149e18781e5c62 Mon Sep 17 00:00:00 2001 From: Harshal <37841724+harshalkh@users.noreply.github.com> Date: Wed, 26 Oct 2022 12:46:02 +0530 Subject: [PATCH] Add tests for HowManyTimesRotated (#3669) --- .../searches/HowManyTimesRotatedTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/java/com/thealgorithms/searches/HowManyTimesRotatedTest.java diff --git a/src/test/java/com/thealgorithms/searches/HowManyTimesRotatedTest.java b/src/test/java/com/thealgorithms/searches/HowManyTimesRotatedTest.java new file mode 100644 index 00000000..320222f5 --- /dev/null +++ b/src/test/java/com/thealgorithms/searches/HowManyTimesRotatedTest.java @@ -0,0 +1,17 @@ +package com.thealgorithms.searches; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +public class HowManyTimesRotatedTest { + + @Test + public void testHowManyTimesRotated() { + int[] arr1 = {5, 1,2,3,4}; + assertEquals(1, HowManyTimesRotated.rotated(arr1)); + int[] arr2 = {15,17,2,3,5}; + assertEquals(2, HowManyTimesRotated.rotated(arr2)); + } +} +