Skip to content

Version 0.2.0 #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 17, 2020
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
27 changes: 17 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# wsjcpp-core

[![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)
[![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/)

Basic utils for wsjcpp

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

### currentTime_milliseconds
### getCurrentTimeInMilliseconds

```
static long currentTime_milliseconds();
static long getCurrentTimeInMilliseconds();
```

### currentTime_seconds
### getCurrentTimeInSeconds

```
static long currentTime_seconds();
static long getCurrentTimeInSeconds();
```

### currentTime_forFilename
### getCurrentTimeForFilename

```
static std::string currentTime_forFilename();
static std::string getCurrentTimeForFilename();
```

### currentTime_logformat
will be like this: `?`

### getCurrentTimeForLogFormat

```
static std::string currentTime_logformat();
static std::string getCurrentTimeForLogFormat();
```

### threadId
will be like this: `2020-09-17 02:22:40.755`

### getThreadId

```
static std::string threadId();
static std::string getThreadId();
```

will be like this: `0x00007fa9c6a96740`

### formatTimeForWeb

```
Expand Down
103 changes: 103 additions & 0 deletions scripts.wsjcpp/generate.WsjcppUnitTest
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/usr/bin/wsjcpp-safe-scripting

# log_info rootdir
# log_info script_filename

make_dir "./unit-tests.wsjcpp"
make_dir "./unit-tests.wsjcpp/src"

var user_class_name
set_value user_class_name arg1
normalize_class_name user_class_name
var class_name
set_value class_name "UnitTest"
concat class_name user_class_name

var base_filename
convert_CamelCase_to_snake_case class_name base_filename
# log_info base_filename

var filename_cpp
concat filename_cpp "./unit-tests.wsjcpp/src/" base_filename ".cpp"

var filename_h
concat filename_h "./unit-tests.wsjcpp/src/" base_filename ".h"

var ifndef_header
set_value ifndef_header base_filename
concat ifndef_header "_H"

to_upper_case ifndef_header

var content_header
concat content_header "#ifndef " ifndef_header "
#define " ifndef_header "

#include <wsjcpp_unit_tests.h>

class " class_name " : public WsjcppUnitTestBase {
public:
" class_name "();
virtual bool doBeforeTest() override;
virtual void executeTest() override;
virtual bool doAfterTest() override;
};

#endif // " ifndef_header


var content_source
concat content_source "
#include \"" base_filename ".h\"
#include <wsjcpp_core.h>

// ---------------------------------------------------------------------
// " class_name "

REGISTRY_WSJCPP_UNIT_TEST(" class_name ")

" class_name "::" class_name "()
: WsjcppUnitTestBase(\"" class_name "\") {
}

// ---------------------------------------------------------------------

bool " class_name "::doBeforeTest() {
// nothing
return true;
}

// ---------------------------------------------------------------------

void " class_name "::executeTest() {
compare(\"Not implemented\", true, false);
// TODO unit test source code here
}

// ---------------------------------------------------------------------

bool " class_name "::doAfterTest() {
// nothing
return true;
}

"

var file_source
concat file_source "src/" filename_cpp

write_file filename_h content_header
write_file filename_cpp content_source

log_info "
======
Generated class:
- " class_name "
Generated files:
- " filename_h "
- " filename_cpp "
======
"

wsjcpp_yml_unit_test_add user_class_name filename_h
wsjcpp_yml_unit_test_add user_class_name filename_cpp
4 changes: 2 additions & 2 deletions src.wsjcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Automaticly generated by wsjcpp@v0.1.5
# Automaticly generated by wsjcpp@v0.1.7
cmake_minimum_required(VERSION 3.0)

add_definitions(-DWSJCPP_APP_VERSION="v0.1.7")
add_definitions(-DWSJCPP_APP_VERSION="v0.2.0")
add_definitions(-DWSJCPP_APP_NAME="wsjcpp-core")

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ int main(int argc, char* argv[]) {
WsjcppCore::recoursiveCopyFiles("./tmp", "./tmp2");
WsjcppCore::recoursiveRemoveDir("./tmp2");

WsjcppCore::getThreadId();

return 0;
}
Loading