-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathPlotlyLibTest.cpp
More file actions
59 lines (52 loc) · 2.05 KB
/
PlotlyLibTest.cpp
File metadata and controls
59 lines (52 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "gtest/gtest.h"
#include "plotly_maker/plotly_maker.h"
#include <fstream>
using std::string;
TEST(PlotlyMaker, CreateDefaultHeatMapHtmlPageTest) {
std::vector<std::vector<double>>testValues = {{43, 400, 54, 980}, {200, 36, 400, 55}, {120, 4, 650, 5}};
std::string str_page = "test_page";
auto config = dv::Config();
config.typeVisual = dv::VISUALTYPE_HEATMAP;
bool result = dvs::createHtmlPageHeatmap(testValues, str_page, config);
std::ofstream out("example.html");
if (out.is_open()) {
out << str_page.c_str();
std::cout << "Write to file...";
out.close();
} else {
std::cout << "Unable to open file...";
}
EXPECT_EQ(result, true);
}
TEST(PlotlyMaker, ShowGlamourHeatMapHtmlPageTest) {
std::vector<std::vector<double>>testValues = {{43, 400, 54, 980}, {200, 36, 400, 55}, {120, 4, 650, 5}};
std::string str_page = "veryGlamourPage";
auto config = dv::Config();
config.heatmap.colorSc = dv::config_colorscales::COLORSCALE_GLAMOUR;
bool result = dvs::showHeatMapInBrowser(testValues, str_page, config);
EXPECT_EQ(result, true);
}
TEST(PlotlyMaker, ShowThermalHeatMapHtmlPageTest) {
std::vector<std::vector<double>>testValues = {{43, 400, 54, 980}, {200, 36, 400, 55}, {120, 4, 650, 5}};
std::string str_page = "veryHotPage";
auto config = dv::Config();
config.heatmap.colorSc = dv::config_colorscales::COLORSCALE_THERMAL;
bool result = dvs::showHeatMapInBrowser(testValues, str_page, config);
EXPECT_EQ(result, true);
}
TEST(PlotlyMaker, ShowSunnyHeatMapHtmlPageTest) {
std::vector<std::vector<double>>testValues = {{43, 400, 54, 980}, {200, 36, 400, 55}, {120, 4, 650, 5}};
std::string str_page = "SunnyPage";
auto config = dv::Config();
config.heatmap.colorSc = dv::config_colorscales::COLORSCALE_SUNNY;
bool result = dvs::showHeatMapInBrowser(testValues, str_page, config);
EXPECT_EQ(result, true);
}
TEST(PlotlyMaker, ShowWarnigJsAbsentPageTest) {
dvs::showWarningJsAbsentPage();
}
int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
std::ignore = RUN_ALL_TESTS();
return 0;
}