mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-11 14:36:25 +08:00
std::cout after assert
This commit is contained in:
@@ -172,13 +172,13 @@ static void test1() {
|
||||
uint64_t n = 10;///< number of items
|
||||
dsu d(n+1);///< object of class disjoint sets
|
||||
//set 1
|
||||
cout << "Test case# 1: passed"<<endl;
|
||||
d.UnionSet(1,2); //performs union operation on 1 and 2
|
||||
d.UnionSet(1,4); //performs union operation on 1 and 4
|
||||
vector<uint64_t> ans = {1,4,3};
|
||||
for(uint64_t i=0;i<ans.size();i++){
|
||||
assert(d.get(4).at(i) == ans[i]); //makes sure algorithm works fine
|
||||
}
|
||||
cout << "Test case# 1: passed"<<endl;
|
||||
}
|
||||
/**
|
||||
* @brief Self-implementation Test case #2
|
||||
@@ -189,7 +189,6 @@ static void test2() {
|
||||
uint64_t n = 10;///< number of items
|
||||
dsu d(n+1);///< object of class disjoint sets
|
||||
//set 1
|
||||
cout << "Test case# 2: passed"<<endl;
|
||||
d.UnionSet(3,5);
|
||||
d.UnionSet(5,6);
|
||||
d.UnionSet(5,7);
|
||||
@@ -197,6 +196,7 @@ static void test2() {
|
||||
for(uint64_t i=0;i<ans.size();i++){
|
||||
assert(d.get(3).at(i) == ans[i]); //makes sure algorithm works fine
|
||||
}
|
||||
cout << "Test case# 2: passed"<<endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -129,7 +129,6 @@ class dsu{
|
||||
*/
|
||||
static void test1() {
|
||||
/* checks the parents in the resultant structures */
|
||||
cout << "Test case# 1: passed"<<endl;
|
||||
uint64_t n = 10; ///<number of elements
|
||||
dsu d(n+1); ///< object of class disjoint sets
|
||||
d.unionSet(2,1); //performs union operation on 1 and 2
|
||||
@@ -145,6 +144,7 @@ static void test1() {
|
||||
for(uint64_t i=0;i<ans.size();i++){
|
||||
assert(d.getParents(7).at(i) == ans[i]); //makes sure algorithm works fine
|
||||
}
|
||||
cout << "Test case# 1: passed"<<endl;
|
||||
}
|
||||
/**
|
||||
* @brief Self-implementation Test case #2
|
||||
@@ -152,7 +152,6 @@ static void test1() {
|
||||
*/
|
||||
static void test2() {
|
||||
/* checks the parents in the resultant structures */
|
||||
cout << "Test case# 2: passed"<<endl;
|
||||
uint64_t n = 10; ///<number of elements
|
||||
dsu d(n+1); ///< object of class disjoint sets
|
||||
d.unionSet(2,1); //performs union operation on 1 and 2
|
||||
@@ -169,6 +168,7 @@ static void test2() {
|
||||
for(uint64_t i=0;i<ans.size();i++){
|
||||
assert(d.getParents(2).at(i) == ans[i]); //makes sure algorithm works fine
|
||||
}
|
||||
cout << "Test case# 2: passed"<<endl;
|
||||
}
|
||||
/**
|
||||
* @brief Main function
|
||||
|
||||
Reference in New Issue
Block a user