-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add minimal GFD and GFD with multiple conclusion tests
- Loading branch information
1 parent
c755229
commit 0f5bb57
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <gmock/gmock.h> | ||
#include <gtest/gtest.h> | ||
|
||
#include "algorithms/algo_factory.h" | ||
#include "algorithms/gfd/gfd_miner.h" | ||
#include "config/names.h" | ||
#include "csv_config_util.h" | ||
|
||
using namespace algos; | ||
using algos::StdParamsMap; | ||
|
||
namespace tests { | ||
|
||
namespace { | ||
|
||
auto current_path = kTestDataDir / "graph_data"; | ||
|
||
class GfdMiningTest : public ::testing::Test { | ||
public: | ||
static std::unique_ptr<algos::GfdMiner> CreateGfdMiningInstance( | ||
std::filesystem::path const& graph_path, std::size_t const& k, | ||
std::size_t const& sigma) { | ||
StdParamsMap option_map = {{config::names::kGraphData, graph_path}, | ||
{config::names::kGfdK, k}, | ||
{config::names::kGfdSigma, sigma}}; | ||
return algos::CreateAndLoadAlgorithm<GfdMiner>(option_map); | ||
} | ||
}; | ||
|
||
TEST_F(GfdMiningTest, TestMinGfd) { | ||
auto graph_path = current_path / "blogs_graph.dot"; | ||
auto algorithm = CreateGfdMiningInstance(graph_path, 2, 3); | ||
algorithm->Execute(); | ||
std::vector<Gfd> gfd_list = algorithm->GfdList(); | ||
int expected_size = gfd_list.size(); | ||
algorithm = CreateGfdMiningInstance(graph_path, 3, 3); | ||
algorithm->Execute(); | ||
gfd_list = algorithm->GfdList(); | ||
ASSERT_EQ(expected_size, gfd_list.size()); | ||
} | ||
|
||
TEST_F(GfdMiningTest, TestComplexConclusion) { | ||
auto graph_path = current_path / "channels_graph.dot"; | ||
auto algorithm = CreateGfdMiningInstance(graph_path, 2, 3); | ||
int expected_size = 1; | ||
algorithm->Execute(); | ||
std::vector<Gfd> gfd_list = algorithm->GfdList(); | ||
ASSERT_EQ(expected_size, gfd_list.size()); | ||
} | ||
|
||
} // namespace | ||
|
||
} // namespace tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
graph G { | ||
0[label=blog author=Leonardo]; | ||
1[label=blog author=Raphael]; | ||
2[label=blog author=Donatello]; | ||
3[label=blog author=Michelangelo]; | ||
4[label=blog author=Donatello]; | ||
5[label=blog author=Michelangelo]; | ||
6[label=blog author=Donatello]; | ||
7[label=account name=Leonardo]; | ||
8[label=account name=Donatello]; | ||
9[label=account name=Raphael]; | ||
10[label=account name=Michelangelo]; | ||
7--0 [label=post]; | ||
7--1 [label=like]; | ||
7--2 [label=like]; | ||
8--0 [label=like]; | ||
8--2 [label=post]; | ||
8--4 [label=post]; | ||
8--5 [label=like]; | ||
8--6 [label=post]; | ||
9--1 [label=post]; | ||
9--3 [label=like]; | ||
10--3 [label=post]; | ||
10--4 [label=like]; | ||
10--5 [label=post]; | ||
10--6 [label=like]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
graph G { | ||
0[label=task difficulty=easy]; | ||
1[label=task difficulty=normal]; | ||
2[label=task difficulty=normal]; | ||
3[label=task difficulty=hard]; | ||
4[label=task difficulty=hard]; | ||
5[label=task difficulty=hard]; | ||
6[label=student name=James degree=bachelor year=2]; | ||
7[label=student name=Michael degree=master year=1]; | ||
8[label=student name=Robert degree=bachelor year=3]; | ||
9[label=student name=John degree=master year=2]; | ||
10[label=student name=David degree=bachelor year=4]; | ||
11[label=student name=William degree=master year=2]; | ||
12[label=student name=Richard degree=master year=2]; | ||
13[label=student name=Joseph degree=master year=2]; | ||
14[label=student name=Thomas degree=master year=2]; | ||
15[label=student name=Christopher degree=master year=2]; | ||
0--6 [label=performs]; | ||
1--6 [label=performs]; | ||
1--7 [label=performs]; | ||
1--10 [label=performs]; | ||
2--7 [label=performs]; | ||
2--8 [label=performs]; | ||
2--9 [label=performs]; | ||
3--9 [label=performs]; | ||
3--11 [label=performs]; | ||
3--12 [label=performs]; | ||
4--12 [label=performs]; | ||
4--13 [label=performs]; | ||
4--14 [label=performs]; | ||
5--11 [label=performs]; | ||
5--14 [label=performs]; | ||
5--15 [label=performs]; | ||
} |