Skip to content

Commit ef1ad3e

Browse files
authored
Merge pull request #37 from wsjcpp/version-0.2.4
Version 0.2.4
2 parents 1829e97 + 38d6a17 commit ef1ad3e

File tree

13 files changed

+312
-54
lines changed

13 files changed

+312
-54
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ All notable changes to wsjcpp-core project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [v0.2.4] - 2026-02-04 (2026 Feb 4)
9+
10+
- New function: englishAlphabetLowerCase
11+
- New function: englishAlphabetUpperCase
12+
- New function: englishAlphabetBothCase
13+
- New function: englishAlphabetBothCaseAndNumbers
14+
- New function: randomString
15+
- Added define: WSJCPP_CORE_VER_0_2_4
16+
- Added license information to source-code
17+
818
## [v0.2.3] - 2023-02-01 (2023 Feb 1)
919

1020
### Added

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 wsjcpp
3+
Copyright (c) 2019-2026 Evgenii Sopov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
</a>
77
</p>
88

9-
[![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)
10-
[![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/)
9+
[![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)
1110

1211
Basic utils for wsjcpp
1312

build_simple.sh

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
#!/bin/bash
22

3-
if [ ! -d tmp ]; then
4-
mkdir -p tmp
5-
fi
3+
check_ret() {
4+
if [ $1 -ne 0 ]; then
5+
echo ""
6+
echo "!!! FAIL: $2"
7+
echo "********************************************************************************"
8+
echo ""
9+
exit $1
10+
else
11+
echo ""
12+
echo "*** SUCCESS: $2"
13+
echo "********************************************************************************"
14+
echo ""
15+
fi
16+
}
617

7-
cd tmp
8-
cmake ..
9-
make
18+
# if [ ! -d tmp ]; then
19+
# mkdir -p tmp
20+
# fi
21+
22+
cmake -H. -Btmp/release -DCMAKE_BUILD_TYPE=Release
23+
check_ret $? "configure"
24+
25+
cmake --build tmp/release --config Release
26+
check_ret $? "make"
27+
28+
cd unit-tests.wsjcpp
29+
30+
cmake -H. -Btmp/release -DCMAKE_BUILD_TYPE=Release
31+
check_ret $? "configure"
32+
33+
cmake --build tmp/release --config Release
34+
check_ret $? "make"
35+
36+
./run_unit-tests.sh

src/main.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2019-2026 Evgenii Sopov
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
// original source-code: https://github.com/wsjcpp/wsjcpp-core
26+
127
#include <string.h>
228
#include <iostream>
329
#include <algorithm>

src/wsjcpp_core.cpp

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,37 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2019-2026 Evgenii Sopov
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
// original source-code: https://github.com/wsjcpp/wsjcpp-core
26+
127
#include "wsjcpp_core.h"
228

329
#ifndef _MSC_VER
430
#include <dirent.h>
531
#include <sys/time.h>
632
#include <unistd.h>
733
#include <arpa/inet.h>
8-
#else
34+
#else
935
#include <direct.h>
1036
#define PATH_MAX 256
1137
#endif
@@ -1297,3 +1323,36 @@ bool WsjcppResourcesManager::extractFiles(const std::string &sWorkspace) {
12971323
}
12981324
*/
12991325

1326+
namespace wsjcpp {
1327+
1328+
const std::string &Core::englishAlphabetLowerCase() {
1329+
static const std::string ret = "abcdefghijklmnopqrstuvwxyz";
1330+
return ret;
1331+
}
1332+
1333+
const std::string &Core::englishAlphabetUpperCase() {
1334+
static const std::string ret = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1335+
return ret;
1336+
}
1337+
1338+
const std::string &Core::englishAlphabetBothCase() {
1339+
static const std::string ret = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
1340+
return ret;
1341+
}
1342+
1343+
const std::string &Core::englishAlphabetBothCaseAndNumbers() {
1344+
static const std::string ret = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
1345+
return ret;
1346+
}
1347+
1348+
std::string Core::randomString(const std::string &alphabet, int length) {
1349+
std::string ret = "";
1350+
ret.resize(length, alphabet[0]);
1351+
int alphabet_len = alphabet.length();
1352+
for (int i = 0; i < length; i++) {
1353+
ret[i] = alphabet[rand() % alphabet_len];
1354+
}
1355+
return ret;
1356+
}
1357+
1358+
} // namespace wsjcpp

src/wsjcpp_core.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,36 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2019-2026 Evgenii Sopov
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
// original source-code: https://github.com/wsjcpp/wsjcpp-core
26+
127
#ifndef WSJCPP_CORE_H
228
#define WSJCPP_CORE_H
329

30+
#define WSJCPP_CORE_VER_0
31+
#define WSJCPP_CORE_VER_0_2
32+
#define WSJCPP_CORE_VER_0_2_4
33+
434
#include <string>
535
#include <vector>
636
#include <map>
@@ -234,6 +264,18 @@ class WsjcppResourcesManager {
234264
#define REGISTRY_WSJCPP_RESOURCE_FILE( classname ) \
235265
static classname * pRegistryWsjcppResourceFile ## classname = new classname(); \
236266

267+
namespace wsjcpp {
268+
269+
class Core {
270+
public:
271+
static const std::string &englishAlphabetLowerCase();
272+
static const std::string &englishAlphabetUpperCase();
273+
static const std::string &englishAlphabetBothCase();
274+
static const std::string &englishAlphabetBothCaseAndNumbers();
275+
static std::string randomString(const std::string &alphabet, int length);
276+
};
277+
278+
} // namespace wsjcpp
237279

238280
#endif // WSJCPP_CORE_H
239281

src/wsjcpp_unit_tests.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2019-2026 Evgenii Sopov
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
// original source-code: https://github.com/wsjcpp/wsjcpp-core
26+
127
#include "wsjcpp_unit_tests.h"
228
#include <cmath>
329

@@ -93,7 +119,7 @@ void WsjcppUnitTests::addUnitTest(const std::string &sTestName, WsjcppUnitTestBa
93119
bFound = true;
94120
}
95121
}
96-
122+
97123
if (bFound) {
98124
WsjcppLog::err(sTestName, "Already registered");
99125
} else {

src/wsjcpp_unit_tests.h

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2019-2026 Evgenii Sopov
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
// original source-code: https://github.com/wsjcpp/wsjcpp-core
26+
127
#ifndef WSJCPP_UNIT_TESTS_H
228
#define WSJCPP_UNIT_TESTS_H
329

@@ -17,7 +43,7 @@ class WsjcppUnitTestBase {
1743
virtual bool doAfterTest() = 0;
1844
protected:
1945
std::string TAG;
20-
46+
2147
bool compareD(const std::string &sMark, double nValue, double nExpected);
2248
template<typename T1, typename T2> bool compare(const std::string &sMark, T1 tGotValue, T2 tExpectedValue) {
2349
if (tGotValue != tExpectedValue) {

src/wsjcpp_unit_tests_main.cpp

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2019-2026 Evgenii Sopov
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
// original source-code: https://github.com/wsjcpp/wsjcpp-core
26+
127
#include <string>
228
#include <wsjcpp_core.h>
329
#include <wsjcpp_unit_tests.h>
430

531
void printHelp(const std::string &sProgramName) {
632
std::string sOutput = "\nHelp:\n";
7-
sOutput +=
33+
sOutput +=
834
" '" + sProgramName + "' - run all unit-tests\n"
935
" '" + sProgramName + " help' - print this help\n"
1036
" '" + sProgramName + " list' - print list of unit-tests\n"

0 commit comments

Comments
 (0)