Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 25 additions & 24 deletions Tests/CommonUtilsTest.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#include "gtest/gtest.h"
#include "common_utils/common_utils.h"
#include <fstream>
#include <codecvt>
#include <locale>
#include <fstream>
#include <iostream>
//#include <windows.h>
#include <locale>

#include "common_utils/common_utils.h"
#include "gtest/gtest.h"
// #include <windows.h>

using std::string;
using std::vector;

vector<string> args{"Apple", "Orange", "Banan", "Pineapple", "Kiwi"};

vector<string> args_big{"Yes",//1
"No", //2
"Ok", //3
"Good",//4
"Bad",//5
"Nice",//6
"Ugly",//7
"Perfect",//8
"Strong",//9
"Davis",//10
"Cat",//11
"Plotly"//12
vector<string> args_big{
"Yes", // 1
"No", // 2
"Ok", // 3
"Good", // 4
"Bad", // 5
"Nice", // 6
"Ugly", // 7
"Perfect", // 8
"Strong", // 9
"Davis", // 10
"Cat", // 11
"Plotly" // 12
};

constexpr char check_test_string_1[] =
Expand All @@ -47,18 +48,17 @@ constexpr char not_filled_test_string_3[] =
// C++ stream interface
class TestCout : public std::stringstream {
public:
~TestCout() {
std::cout << str() << std::flush;
}
~TestCout() { std::cout << str() << std::flush; }
};

#define TEST_COUT TestCout()
#define TEST_COUT TestCout()

TEST(CommonUtils, CreateStringFromArgs1) {
string out;
dvs::make_string(not_filled_test_string_1, args, out);
EXPECT_EQ(check_test_string_1, out) << out;
vector<string> neg_args{"Strawbery", "Orange", "Banan", "Pineapple", "Kiwi"};
vector<string> neg_args{"Strawbery", "Orange", "Banan", "Pineapple",
"Kiwi"};
dvs::make_string(not_filled_test_string_1, neg_args, out);
EXPECT_FALSE(check_test_string_1 == out);
}
Expand All @@ -77,12 +77,11 @@ TEST(CommonUtils, CreateStringFromBigArgs) {

TEST(CommonUtils, CreateStringFantasyArgs) {
string out;
vector<string>sample = {"Ferrari", "Ford", "BMW", "Tatra"};
vector<string> sample = {"Ferrari", "Ford", "BMW", "Tatra"};
dvs::make_string("I like %1 100%! I don't like %4.", sample, out);
EXPECT_EQ("I like Ferrari 100%! I don't like Tatra.", out) << out;
}


TEST(CommonUtils, SplitString) {
auto result = dvs::split(not_filled_test_string_1, '%');
for (size_t i = 0; i < result.size(); ++i) {
Expand Down Expand Up @@ -131,6 +130,8 @@ TEST(CommonUtils, RussianFileC) {

}*/

TEST(CommonUtils, JsDownloadByCurl) { dvs::tryToDownloadJsByCurl(); }

int main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
std::ignore = RUN_ALL_TESTS();
Expand Down
10 changes: 6 additions & 4 deletions common_utils/common_constants.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "common_constants.h"
#include "string"

namespace dvs {
//#START_GRAB_TO_DVS_NAMESPACE
// #START_GRAB_TO_DVS_NAMESPACE
const char kAppName[] = "davis";
const char kOutFolderName[] = "davis_htmls/";
const char kPlotlyJsWorkPath[] = "./davis_htmls/plotly-2.32.0.min.js";
Expand All @@ -10,5 +10,7 @@ const char kPlotlyJsResourcePath[] = "plotly_maker/plotly-2.32.0.min.js";
const char kWarningPagePath[] = "./davis_htmls/warning_js_absent.html";
const char kReportPagePath[] = "./davis_htmls/report.html";
const char kCloudPagePath[] = "./davis_htmls/cloud_of_points.html";
//#STOP_GRAB_TO_DVS_NAMESPACE
}
const char kJsUrlToDownolad[] =
"https://cdnjs.cloudflare.com/ajax/libs/plotly.js/2.32.0/plotly.min.js";
// #STOP_GRAB_TO_DVS_NAMESPACE
} // namespace dvs
9 changes: 5 additions & 4 deletions common_utils/common_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define COMMON_UTILS_COMMON_CONSTANTS_H

namespace dvs {
//#START_GRAB_TO_DVS_NAMESPACE
// #START_GRAB_TO_DVS_NAMESPACE
extern const char kAppName[];
extern const char kOutFolderName[];
extern const char kPlotlyJsName[];
Expand All @@ -11,7 +11,8 @@ extern const char kPlotlyJsWorkPath[];
extern const char kWarningPagePath[];
extern const char kReportPagePath[];
extern const char kCloudPagePath[];
//#STOP_GRAB_TO_DVS_NAMESPACE
}
extern const char kJsUrlToDownolad[];
// #STOP_GRAB_TO_DVS_NAMESPACE
} // namespace dvs

#endif // COMMON_UTILS_COMMON_CONSTANTS_H
#endif // COMMON_UTILS_COMMON_CONSTANTS_H
Loading
Loading