Skip to content

Commit 5a80b45

Browse files
authored
Merge pull request #20 from wsjcpp/version-0.2.0
Version 0.2.0
2 parents 2c1cb21 + 7440123 commit 5a80b45

File tree

55 files changed

+1332
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1332
-253
lines changed

README.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# wsjcpp-core
22

33
[![Build Status](https://api.travis-ci.org/wsjcpp/wsjcpp-core.svg?branch=master)](https://travis-ci.org/wsjcpp/wsjcpp-core) [![Github Stars](https://img.shields.io/github/stars/wsjcpp/wsjcpp-core.svg?label=github%20%E2%98%85)](https://github.com/wsjcpp/wsjcpp-core/stargazers) [![Github Stars](https://img.shields.io/github/contributors/wsjcpp/wsjcpp-core.svg)](https://github.com/wsjcpp/wsjcpp-core/) [![Github Forks](https://img.shields.io/github/forks/wsjcpp/wsjcpp-core.svg?label=github%20forks)](https://github.com/wsjcpp/wsjcpp-core/network/members)
4+
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/wsjcpp/wsjcpp-core.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-core/context:cpp) [![Total alerts](https://img.shields.io/lgtm/alerts/g/wsjcpp/wsjcpp-core.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/wsjcpp/wsjcpp-core/alerts/)
45

56
Basic utils for wsjcpp
67

@@ -86,36 +87,42 @@ std::string sFilename = WsjcppCore::doNormalizePath(".//../bin/some/../file.txt"
8687
static std::string getCurrentDirectory();
8788
```
8889

89-
### currentTime_milliseconds
90+
### getCurrentTimeInMilliseconds
9091

9192
```
92-
static long currentTime_milliseconds();
93+
static long getCurrentTimeInMilliseconds();
9394
```
9495

95-
### currentTime_seconds
96+
### getCurrentTimeInSeconds
9697

9798
```
98-
static long currentTime_seconds();
99+
static long getCurrentTimeInSeconds();
99100
```
100101

101-
### currentTime_forFilename
102+
### getCurrentTimeForFilename
102103

103104
```
104-
static std::string currentTime_forFilename();
105+
static std::string getCurrentTimeForFilename();
105106
```
106107

107-
### currentTime_logformat
108+
will be like this: `?`
109+
110+
### getCurrentTimeForLogFormat
108111

109112
```
110-
static std::string currentTime_logformat();
113+
static std::string getCurrentTimeForLogFormat();
111114
```
112115

113-
### threadId
116+
will be like this: `2020-09-17 02:22:40.755`
117+
118+
### getThreadId
114119

115120
```
116-
static std::string threadId();
121+
static std::string getThreadId();
117122
```
118123

124+
will be like this: `0x00007fa9c6a96740`
125+
119126
### formatTimeForWeb
120127

121128
```
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
#!/usr/bin/wsjcpp-safe-scripting
2+
3+
# log_info rootdir
4+
# log_info script_filename
5+
6+
make_dir "./unit-tests.wsjcpp"
7+
make_dir "./unit-tests.wsjcpp/src"
8+
9+
var user_class_name
10+
set_value user_class_name arg1
11+
normalize_class_name user_class_name
12+
var class_name
13+
set_value class_name "UnitTest"
14+
concat class_name user_class_name
15+
16+
var base_filename
17+
convert_CamelCase_to_snake_case class_name base_filename
18+
# log_info base_filename
19+
20+
var filename_cpp
21+
concat filename_cpp "./unit-tests.wsjcpp/src/" base_filename ".cpp"
22+
23+
var filename_h
24+
concat filename_h "./unit-tests.wsjcpp/src/" base_filename ".h"
25+
26+
var ifndef_header
27+
set_value ifndef_header base_filename
28+
concat ifndef_header "_H"
29+
30+
to_upper_case ifndef_header
31+
32+
var content_header
33+
concat content_header "#ifndef " ifndef_header "
34+
#define " ifndef_header "
35+
36+
#include <wsjcpp_unit_tests.h>
37+
38+
class " class_name " : public WsjcppUnitTestBase {
39+
public:
40+
" class_name "();
41+
virtual bool doBeforeTest() override;
42+
virtual void executeTest() override;
43+
virtual bool doAfterTest() override;
44+
};
45+
46+
#endif // " ifndef_header
47+
48+
49+
var content_source
50+
concat content_source "
51+
#include \"" base_filename ".h\"
52+
#include <wsjcpp_core.h>
53+
54+
// ---------------------------------------------------------------------
55+
// " class_name "
56+
57+
REGISTRY_WSJCPP_UNIT_TEST(" class_name ")
58+
59+
" class_name "::" class_name "()
60+
: WsjcppUnitTestBase(\"" class_name "\") {
61+
}
62+
63+
// ---------------------------------------------------------------------
64+
65+
bool " class_name "::doBeforeTest() {
66+
// nothing
67+
return true;
68+
}
69+
70+
// ---------------------------------------------------------------------
71+
72+
void " class_name "::executeTest() {
73+
compare(\"Not implemented\", true, false);
74+
// TODO unit test source code here
75+
}
76+
77+
// ---------------------------------------------------------------------
78+
79+
bool " class_name "::doAfterTest() {
80+
// nothing
81+
return true;
82+
}
83+
84+
"
85+
86+
var file_source
87+
concat file_source "src/" filename_cpp
88+
89+
write_file filename_h content_header
90+
write_file filename_cpp content_source
91+
92+
log_info "
93+
======
94+
Generated class:
95+
- " class_name "
96+
Generated files:
97+
- " filename_h "
98+
- " filename_cpp "
99+
======
100+
"
101+
102+
wsjcpp_yml_unit_test_add user_class_name filename_h
103+
wsjcpp_yml_unit_test_add user_class_name filename_cpp

src.wsjcpp/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Automaticly generated by [email protected].5
1+
# Automaticly generated by [email protected].7
22
cmake_minimum_required(VERSION 3.0)
33

4-
add_definitions(-DWSJCPP_APP_VERSION="v0.1.7")
4+
add_definitions(-DWSJCPP_APP_VERSION="v0.2.0")
55
add_definitions(-DWSJCPP_APP_NAME="wsjcpp-core")
66

77
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

src/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@ int main(int argc, char* argv[]) {
3030
WsjcppCore::recoursiveCopyFiles("./tmp", "./tmp2");
3131
WsjcppCore::recoursiveRemoveDir("./tmp2");
3232

33+
WsjcppCore::getThreadId();
34+
3335
return 0;
3436
}

0 commit comments

Comments
 (0)