From 77b24ecdfaa197f957dbb663c94798533c4f4698 Mon Sep 17 00:00:00 2001 From: thanhphuonghdhh <19021346@vnu.edu.vn> Date: Sun, 22 May 2022 23:49:46 +0700 Subject: [PATCH 1/3] Update test case for bubbleSort --- Sorts/test/BubbleSort.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Sorts/test/BubbleSort.test.js b/Sorts/test/BubbleSort.test.js index 87ff3e15ab..85302b7398 100644 --- a/Sorts/test/BubbleSort.test.js +++ b/Sorts/test/BubbleSort.test.js @@ -18,3 +18,21 @@ describe('alternativeBubbleSort', () => { expect(alternativeBubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) }) }) +//add unit test with MCC coverage +describe('bubbleSort', () => { + it('should sort arrays correctly', () => { + expect(bubbleSort([1, 2, 3])).toEqual([1, 2, 3]) + expect(bubbleSort([2,1,3])).toEqual([1, 2, 3]) + expect(bubbleSort([10,15,16,100])).toEqual([10,15,16,100]) + expect(bubbleSort([10,9,11])).toEqual([9,10,11]) + }) +}) +//add unit test with all-du path coverage +describe('bubbleSort', () => { + it('should sort arrays correctly', () => { + expect(bubbleSort([1, 2, 3])).toEqual([1, 2, 3]) + expect(bubbleSort([2,1,3])).toEqual([1, 2, 3]) + expect(bubbleSort([10,15,16,100])).toEqual([10,15,16,100]) + expect(bubbleSort([10,9,11])).toEqual([9,10,11]) + }) +}) \ No newline at end of file From a55119d9e5aaa09a524969631b6867a117de4d62 Mon Sep 17 00:00:00 2001 From: thanhphuonghdhh <19021346@vnu.edu.vn> Date: Mon, 23 May 2022 08:19:34 +0700 Subject: [PATCH 2/3] re-update test case for bubble sort --- Sorts/test/BubbleSort.test.js | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/Sorts/test/BubbleSort.test.js b/Sorts/test/BubbleSort.test.js index 85302b7398..ba0dcc2c23 100644 --- a/Sorts/test/BubbleSort.test.js +++ b/Sorts/test/BubbleSort.test.js @@ -7,6 +7,11 @@ describe('bubbleSort', () => { expect(bubbleSort([1, 2, 3])).toEqual([1, 2, 3]) expect(bubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) expect(bubbleSort([5, 6, 7, 8, 9, 4])).toEqual([4, 5, 6, 7, 8, 9]) + expect(bubbleSort([2,1,3])).toEqual([1, 2, 3]) + expect(bubbleSort([10,15,16,100])).toEqual([10,15,16,100]) + expect(bubbleSort([10,9,11])).toEqual([9,10,11]) + expect(bubbleSort([3,2,1])).toEqual([1, 2, 3]) + expect(bubbleSort([10,9,8])).toEqual([8,9,10]) }) }) @@ -18,21 +23,3 @@ describe('alternativeBubbleSort', () => { expect(alternativeBubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) }) }) -//add unit test with MCC coverage -describe('bubbleSort', () => { - it('should sort arrays correctly', () => { - expect(bubbleSort([1, 2, 3])).toEqual([1, 2, 3]) - expect(bubbleSort([2,1,3])).toEqual([1, 2, 3]) - expect(bubbleSort([10,15,16,100])).toEqual([10,15,16,100]) - expect(bubbleSort([10,9,11])).toEqual([9,10,11]) - }) -}) -//add unit test with all-du path coverage -describe('bubbleSort', () => { - it('should sort arrays correctly', () => { - expect(bubbleSort([1, 2, 3])).toEqual([1, 2, 3]) - expect(bubbleSort([2,1,3])).toEqual([1, 2, 3]) - expect(bubbleSort([10,15,16,100])).toEqual([10,15,16,100]) - expect(bubbleSort([10,9,11])).toEqual([9,10,11]) - }) -}) \ No newline at end of file From 7e338accb5d6d8b42ec8a966ad3e8bcb6eadfe70 Mon Sep 17 00:00:00 2001 From: thanhphuonghdhh <19021346@vnu.edu.vn> Date: Mon, 23 May 2022 09:03:04 +0700 Subject: [PATCH 3/3] re-update test case for bubbleSort --- Sorts/test/BubbleSort.test.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Sorts/test/BubbleSort.test.js b/Sorts/test/BubbleSort.test.js index ba0dcc2c23..271de27bfa 100644 --- a/Sorts/test/BubbleSort.test.js +++ b/Sorts/test/BubbleSort.test.js @@ -7,11 +7,13 @@ describe('bubbleSort', () => { expect(bubbleSort([1, 2, 3])).toEqual([1, 2, 3]) expect(bubbleSort([5, 6, 7, 8, 1, 2, 12, 14])).toEqual([1, 2, 5, 6, 7, 8, 12, 14]) expect(bubbleSort([5, 6, 7, 8, 9, 4])).toEqual([4, 5, 6, 7, 8, 9]) - expect(bubbleSort([2,1,3])).toEqual([1, 2, 3]) - expect(bubbleSort([10,15,16,100])).toEqual([10,15,16,100]) - expect(bubbleSort([10,9,11])).toEqual([9,10,11]) - expect(bubbleSort([3,2,1])).toEqual([1, 2, 3]) - expect(bubbleSort([10,9,8])).toEqual([8,9,10]) + expect(bubbleSort([20, 30, 40])).toEqual([20, 30, 40]) + expect(bubbleSort([2, 1, 3])).toEqual([1, 2, 3]) + expect(bubbleSort([10, 15, 16, 100])).toEqual([10, 15, 16, 100]) + expect(bubbleSort([10, 9, 11])).toEqual([9, 10, 11]) + expect(bubbleSort([10, 9, 12])).toEqual([9, 10, 12]) + expect(bubbleSort([3, 2, 1])).toEqual([1, 2, 3]) + expect(bubbleSort([10, 9, 8])).toEqual([8, 9, 10]) }) })