Skip to content

unit test matching#34

Merged
han8129 merged 5 commits intomasterfrom
S2025/ThangVV/bugfix/StableMatchingMatchesTest
Mar 16, 2025
Merged

unit test matching#34
han8129 merged 5 commits intomasterfrom
S2025/ThangVV/bugfix/StableMatchingMatchesTest

Conversation

@thanggw
Copy link
Copy Markdown
Contributor

@thanggw thanggw commented Mar 13, 2025

No description provided.

Copy link
Copy Markdown
Contributor

@han8129 han8129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anh sẽ kiểm tra hàm getLeastNode, do mình đang làm với TwoSet nên kiểm tra Triplet chưa có tác dụng gì

assertTrue(matches.getSetOf(6).contains(5));
}

@Test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nên sử dụng ParametizedTest để đảm bảo range của input

assertFalse(matchedSet.contains(8));
}

@Test
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nên sử dụng ParametizedTest để đảm bảo input đa dạng

@han8129 han8129 linked an issue Mar 14, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@han8129 han8129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thêm input cho các case để có từ 5..7 input cho mỗi cái. Sửa lại logic ktra both way để không phụ thuộc vào class Matches

Matches matches = new Matches(5);
matches.addMatchBi(node1, node2);

assertTrue(matches.isMatched(node1, node2), "Node1 and Node2 should be matched both ways");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

khi kiểm tra tránh để logic của mình bị phụ thuộc vào method của class bị kiểm tra. Cần phải tự lấy ra match của mỗi index và ktra

@han8129 han8129 self-requested a review March 15, 2025 14:43
Copy link
Copy Markdown
Contributor

@han8129 han8129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xem xét lại testSelectNewMatch chỉ cần ktra getLeastNode thôi nhé

Comment on lines +13 to +34
// 1. Select New Match
@ParameterizedTest
@CsvSource({
"0,1,2,1",
"1,2,3,2",
"2,3,4,3",
"3,4,5,4",
"4,5,6,5",
"5,6,7,6",
"6,7,8,7"
})
void testSelectNewMatch(int targetIndividual, int newIndividual, int leastPreferred, int expected) {
Matches matches = new Matches(10);
matches.addMatch(targetIndividual, leastPreferred);
matches.addMatch(targetIndividual, newIndividual);

Set<Integer> currentMatches = matches.getSetOf(targetIndividual);
currentMatches.add(newIndividual);

Integer result = Collections.min(currentMatches);
assertEquals(expected, result, "The least preferred individual should be " + expected);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cái này đâu có tác dụng gì đâu nhỉ?

"0,5,6,7,8,6",
"0,5,7,8,9,7"
})
void testGetLeastNode(int set, int newNode, int node1, int node2, int node3, int expected) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

có thể thay CsvSource bằng MethodSource nhé em

Copy link
Copy Markdown
Contributor

@han8129 han8129 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tốt

@han8129 han8129 merged commit 03aaebf into master Mar 16, 2025
@han8129 han8129 deleted the S2025/ThangVV/bugfix/StableMatchingMatchesTest branch March 16, 2025 02:22
han8129 pushed a commit that referenced this pull request Mar 17, 2025
* unit test matching

* unit test matching2

* unit test matching3

* unit test matching4

* unit test matching5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unit test SMT matching operation

2 participants