Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c7fa087

Browse files
Create IterativeBinarySearchTest.java (TheAlgorithms#826)
Co-authored-by: o0ovano0o <o0ovano0o@users.noreply.github.com>
1 parent e72d71c commit c7fa087

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

‎Searches/IBSearch_test.java‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
import static org.junit.jupiter.api.Assertions.*;
3+
4+
import org.junit.jupiter.api.Test;
5+
6+
public class IterativeBinarySearch_Test {
7+
8+
// kiem thu luong du lieu
9+
// ham search dung de tim key trong mang da xap xep
10+
// dua theo tieu chi all-du path tim dc 4 tescase
11+
Integer[] arr = {0,1,2,3,4,5,6,7,8,9,10};
12+
IterativeBinarySearch search = new IterativeBinarySearch();
13+
@Test
14+
void tc1_key_khong_co_trong_mang() {
15+
assertTrue(search.find(arr, 11)==-1);
16+
}
17+
@Test
18+
void tc2_key_nam_chinh_giua_mang() {
19+
assertTrue(search.find(arr, 5)==5);
20+
}
21+
@Test
22+
void tc3_key_nam_cuoi_mang() {
23+
assertTrue(search.find(arr, 10)==10);
24+
}
25+
@Test
26+
void tc4_key_nam_dau_mang() {
27+
assertTrue(search.find(arr, 0)==0);
28+
}
29+
}
30+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /