cppunitlite
Advanced tools
Comparing version 0.0.3 to 1.0.0
{ | ||
"name": "cppunitlite", | ||
"version": "0.0.3", | ||
"version": "1.0.0", | ||
"description": "C++ unit testing library", | ||
@@ -8,3 +8,3 @@ "main": "include_dirs.js", | ||
"install": "node-gyp rebuild", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "build/Release/test" | ||
}, | ||
@@ -11,0 +11,0 @@ "repository": { |
@@ -5,2 +5,81 @@ # CppUnitLite - lite c++ testing framework | ||
## Usage | ||
Use CppUnitLite to add unit tests to the c++ side of a node addon. | ||
### Installing | ||
Install cppunitlite with npm. It has no package dependencies, but | ||
requires node-gyp to be installed and working. | ||
$ npm i --save-dev cppunitlite | ||
npm http GET https://registry.npmjs.org/cppunitlite | ||
npm http 304 https://registry.npmjs.org/cppunitlite | ||
> cppunitlite@0.0.3 install Z:\code\node_modules\cppunitlite | ||
> node-gyp rebuild | ||
... platform dependent stuff ... | ||
cppunitlite@0.0.3 node_modules\cppunitlite | ||
### Changes to your binding.gyp | ||
Add a test target to your binding.gyp: | ||
{ | ||
'target_name': 'test', | ||
'type': 'executable', | ||
'sources': [ | ||
# your test files | ||
] | ||
'include_dirs': [ | ||
# your project include files | ||
'<!(node -e "require(\'cpppunitlite\')' | ||
] | ||
'dependencies': [ | ||
'node_modules/cppunitlite/binding.gyp:CppUnitLite' | ||
] | ||
} | ||
### A test main | ||
CppUnitLite does not provide a main() function, but it's easy to write | ||
a minimal one; for example: | ||
#include "CppUnitLite/TestHarness.h" | ||
int main() | ||
{ | ||
TestResult tr; | ||
TestRegistry::runAllTests(tr); | ||
return 0; | ||
} | ||
### Write Unit Tests | ||
The include directories are set up so that the CppUnitLite headers | ||
should be included with a path. | ||
#include "CppUnitLite/TestHarness.h" | ||
#include <string> | ||
static inline SimpleString StringFrom(const std::string& value) | ||
{ | ||
return SimpleString(value.c_str()); | ||
} | ||
TEST( Hello, world ) | ||
{ | ||
std::string s1("Hello"), s2("Hello"), s3("world"); | ||
CHECK_EQUAL(s1, s2); | ||
CHECK_EQUAL(s2, s1); | ||
CHECK(s1 != s3); | ||
} | ||
## Version history | ||
Original version from Michael Feathers | ||
@@ -7,0 +86,0 @@ http://www.objectmentor.com/resources/downloads.html |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
17842
24
0
95