@ -1,7 +0,0 @@ | |||
module.exports = { | |||
"extends": "../.eslintrc.js", | |||
"parserOptions": { | |||
"ecmaVersion": 6, | |||
"sourceType": 'module', | |||
} | |||
} |
@ -1,37 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder, LoraMessage } from '../src'; | |||
import base from './base'; | |||
test('should be possible to construct a simple message', t => { | |||
const m = new LoraMessage(encoder); | |||
m.addUnixtime(base.unixtime); | |||
t.is(m.getLength(), 4); | |||
t.deepEqual(m.getBytes(), base.unixtimeBytes); | |||
t.pass(); | |||
}); | |||
test('should be possible to chain message parts', t => { | |||
const loraMessage = new LoraMessage(encoder); | |||
t.deepEqual( | |||
loraMessage | |||
.addLatLng.apply(loraMessage, base.latLng) | |||
.addUnixtime(base.unixtime) | |||
.addUint16(base.uint16) | |||
.addTemperature(base.temp) | |||
.addUint8(base.uint8) | |||
.addHumidity(base.humidity) | |||
.addBitmap.apply(loraMessage, base.bitmapArgs) | |||
.getBytes() | |||
, | |||
Buffer.concat([ | |||
base.latLngBytes, | |||
base.unixtimeBytes, | |||
base.uint16Bytes, | |||
base.tempBytes, | |||
base.uint8Bytes, | |||
base.humidityBytes, | |||
base.bitmapBytes, | |||
]) | |||
); | |||
t.pass(); | |||
}); |
@ -1,18 +0,0 @@ | |||
CC = g++ | |||
# -g adds debugging information to the executable file | |||
# -Wall turns on most, but not all, compiler warnings | |||
CFLAGS = -g -Wall --coverage | |||
TARGET = main | |||
all: $(TARGET) | |||
$(TARGET): $(TARGET).cpp | |||
$(CC) $(CFLAGS) -o $(TARGET) $(TARGET).cpp | |||
test: | |||
./main | |||
clean: | |||
$(RM) $(TARGET) $(TARGET).gcda $(TARGET).gcno |
@ -1,39 +0,0 @@ | |||
module.exports = { | |||
unixtimeBytes: new Buffer([0x1d, 0x4b, 0x7a, 0x57]), | |||
unixtime: 1467632413, | |||
uint8Bytes: new Buffer([0xFF]), | |||
uint8: 255, | |||
uint16Bytes: new Buffer([0x9d, 0x5b]), | |||
uint16: 23453, | |||
tempBytes: new Buffer([0x1f, 0x4c]), | |||
temp: 80.12, | |||
negativeTempBytes: new Buffer([0xcf, 0xc7]), | |||
negativeTemp: -123.45, | |||
humidityBytes: new Buffer([0x0f, 0x27]), | |||
humidity: 99.99, | |||
latLngBytes: new Buffer([0x64, 0xa6, 0xfa, 0xfd, 0x6a, 0x24, 0x04, 0x09]), | |||
latLng: [-33.905052, 151.26641], | |||
bitmapArgs: [true, true, true, true, true, true, false, true], | |||
bitmap: { | |||
a: true, | |||
b: true, | |||
c: true, | |||
d: true, | |||
e: true, | |||
f: true, | |||
g: false, | |||
h: true | |||
}, | |||
bitmapBytes: new Buffer([253]), | |||
bitmap2: { | |||
a: false, | |||
b: true, | |||
c: false, | |||
d: false, | |||
e: false, | |||
f: false, | |||
g: false, | |||
h: false | |||
}, | |||
bitmap2Bytes: new Buffer([64]), | |||
}; |
@ -1,20 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the buffer is omitted', t => { | |||
t.throws(() => decoder.bitmap(), /undefined/); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the buffer size is incorrect', t => { | |||
t.throws(() => decoder.bitmap(new Buffer([1, 2])), /must have/); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a bitmap', t => { | |||
t.deepEqual(decoder.bitmap(base.bitmapBytes), base.bitmap); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a bitmap with leading false', t => { | |||
t.deepEqual(decoder.bitmap(base.bitmap2Bytes), base.bitmap2); | |||
t.pass(); | |||
}); |
@ -1,52 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should be able to compose decoder functions', t => { | |||
t.deepEqual( | |||
decoder.decode( | |||
Buffer.concat([ | |||
base.latLngBytes, | |||
base.unixtimeBytes, | |||
base.uint16Bytes, | |||
base.tempBytes, | |||
base.uint8Bytes, | |||
base.humidityBytes, | |||
base.bitmapBytes, | |||
]), [ | |||
decoder.latLng, | |||
decoder.unixtime, | |||
decoder.uint16, | |||
decoder.temperature, | |||
decoder.uint8, | |||
decoder.humidity, | |||
decoder.bitmap, | |||
] | |||
), | |||
{ | |||
0: base.latLng, | |||
1: base.unixtime, | |||
2: base.uint16, | |||
3: base.temp, | |||
4: base.uint8, | |||
5: base.humidity, | |||
6: base.bitmap, | |||
} | |||
); | |||
t.pass(); | |||
}); | |||
test('should yell at you if mask is longer than input', t => { | |||
t.throws(() => decoder.decode(new Buffer(7), [decoder.latLng]), /Mask/i); | |||
t.pass(); | |||
}); | |||
test('should be able to take names', t => { | |||
t.deepEqual( | |||
decoder.decode(base.unixtimeBytes, [decoder.unixtime], ['time']), | |||
{ | |||
time: base.unixtime | |||
} | |||
); | |||
t.pass(); | |||
}); |
@ -1,18 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the buffer is omitted', t => { | |||
t.throws(() => decoder.humidity(), /undefined/); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the buffer size is incorrect', t => { | |||
t.throws(() => decoder.humidity(new Buffer([1])), /must have/); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a humidity', t => { | |||
t.is(decoder.humidity(base.humidityBytes), base.humidity); | |||
t.pass(); | |||
}); |
@ -1,18 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the buffer is omitted', t => { | |||
t.throws(() => decoder.latLng(), /undefined/); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the buffer size is incorrect', t => { | |||
t.throws(() => decoder.latLng(new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9])), /must have/); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a coordinate', t => { | |||
t.deepEqual(decoder.latLng(base.latLngBytes), base.latLng); | |||
t.pass(); | |||
}); |
@ -1,23 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the buffer is omitted', t => { | |||
t.throws(() => decoder.temperature(), /undefined/); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the buffer size is incorrect', t => { | |||
t.throws(() => decoder.temperature(new Buffer([1])), /must have/); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a temperature', t => { | |||
t.is(decoder.temperature(base.tempBytes), base.temp); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a negative temperature', t => { | |||
t.is(decoder.temperature(base.negativeTempBytes), base.negativeTemp); | |||
t.pass(); | |||
}); |
@ -1,18 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the buffer is omitted', t => { | |||
t.throws(() => decoder.uint16(), /undefined/); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the buffer size is incorrect', t => { | |||
t.throws(() => decoder.uint16(new Buffer([1])), /must have/); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode an int', t => { | |||
t.is(decoder.uint16(base.uint16Bytes), base.uint16); | |||
t.pass(); | |||
}); |
@ -1,18 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the buffer is omitted', t => { | |||
t.throws(() => decoder.uint8(), /undefined/); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the buffer size is incorrect', t => { | |||
t.throws(() => decoder.uint8(new Buffer([1, 2])), /must have/); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode an int', t => { | |||
t.is(decoder.uint8(base.uint8Bytes), base.uint8); | |||
t.pass(); | |||
}); |
@ -1,18 +0,0 @@ | |||
import test from 'ava'; | |||
import { decoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the buffer is omitted', t => { | |||
t.throws(() => decoder.unixtime(), /undefined/); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the buffer size is incorrect', t => { | |||
t.throws(() => decoder.unixtime(new Buffer([1, 2])), /must have/); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a unixtime', t => { | |||
t.is(decoder.unixtime(base.unixtimeBytes), base.unixtime); | |||
t.pass(); | |||
}); |
@ -1,19 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the bitmap is incorrect', t => { | |||
t.throws(() => encoder.bitmap(1), TypeError); | |||
t.throws(() => encoder.bitmap('a'), TypeError); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode a bitmap', t => { | |||
t.deepEqual(encoder.bitmap.apply(encoder, base.bitmapArgs), base.bitmapBytes); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode a short bitmap', t => { | |||
t.deepEqual(encoder.bitmap(true), new Buffer([0x80])); | |||
t.pass(); | |||
}); |
@ -1,48 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if input is incorrect', t => { | |||
t.throws(() => encoder.encode(), /values/i); | |||
t.throws(() => encoder.encode([]), /mask/i); | |||
t.pass(); | |||
}); | |||
test('should yell at you if input is longer than mask', t => { | |||
t.throws(() => encoder.encode([1,2,3], [encoder.latLng]), /Mask/i); | |||
t.pass(); | |||
}); | |||
test('should be able to compose encoder functions', t => { | |||
t.deepEqual(encoder | |||
.encode( | |||
[ | |||
base.latLng, | |||
base.unixtime, | |||
base.uint16, | |||
base.temp, | |||
base.uint8, | |||
base.humidity, | |||
base.bitmapArgs, | |||
], | |||
[ | |||
encoder.latLng, | |||
encoder.unixtime, | |||
encoder.uint16, | |||
encoder.temperature, | |||
encoder.uint8, | |||
encoder.humidity, | |||
encoder.bitmap, | |||
]), | |||
Buffer.concat([ | |||
base.latLngBytes, | |||
base.unixtimeBytes, | |||
base.uint16Bytes, | |||
base.tempBytes, | |||
base.uint8Bytes, | |||
base.humidityBytes, | |||
base.bitmapBytes, | |||
]) | |||
); | |||
t.pass(); | |||
}); |
@ -1,17 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the humidity is omitted', t => { | |||
t.throws(() => encoder.humidity()); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the humidity is incorrect', t => { | |||
t.throws(() => encoder.humidity(-0.01), /range/); | |||
t.throws(() => encoder.humidity(100.01), /range/); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode a humidity', t => { | |||
t.deepEqual(encoder.humidity(base.humidity), base.humidityBytes); | |||
t.pass(); | |||
}); |
@ -1,22 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the coordinates are omitted', t => { | |||
t.throws(() => encoder.latLng(), /latitude/i); | |||
t.throws(() => encoder.latLng(0), /longitude/i); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the coordinates are incorrect', t => { | |||
t.throws(() => encoder.latLng(-90.000001, 0), /latitude/i); | |||
t.throws(() => encoder.latLng(90.000001, 0), /latitude/i); | |||
t.throws(() => encoder.latLng(0, -180.000001), /longitude/i); | |||
t.throws(() => encoder.latLng(0, 180.000001), /longitude/i); | |||
t.pass(); | |||
}); | |||
test('should be possible to decode a coordinate', t => { | |||
t.deepEqual(encoder.latLng(...base.latLng), base.latLngBytes); | |||
t.pass(); | |||
}); |
@ -1,24 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the temperature is omitted', t => { | |||
t.throws(() => encoder.temperature()); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the temperature is incorrect', t => { | |||
t.throws(() => encoder.temperature(-327.69), /range/); | |||
t.throws(() => encoder.temperature(327.68), /range/); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode a temperature', t => { | |||
t.deepEqual(encoder.temperature(base.temp), base.tempBytes); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode a negative temperature', t => { | |||
t.deepEqual(encoder.temperature(base.negativeTemp), base.negativeTempBytes); | |||
t.pass(); | |||
}); |
@ -1,19 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the uint is omitted', t => { | |||
t.throws(() => encoder.uint16()); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the uint size is incorrect', t => { | |||
t.throws(() => encoder.uint16(-1), /range/); | |||
t.throws(() => encoder.uint16(65536), /range/); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode an int', t => { | |||
t.deepEqual(encoder.uint16(base.uint16), base.uint16Bytes); | |||
t.pass(); | |||
}); |
@ -1,19 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the uint is omitted', t => { | |||
t.throws(() => encoder.uint8()); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the uint is incorrect', t => { | |||
t.throws(() => encoder.uint8(-1), /range/); | |||
t.throws(() => encoder.uint8(256), /range/); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode an int', t => { | |||
t.deepEqual(encoder.uint8(base.uint8), base.uint8Bytes); | |||
t.pass(); | |||
}); |
@ -1,18 +0,0 @@ | |||
import test from 'ava'; | |||
import { encoder } from '../../src'; | |||
import base from '../base'; | |||
test('should yell at you if the unixtime is omitted', t => { | |||
t.throws(() => encoder.unixtime()); | |||
t.pass(); | |||
}); | |||
test('should yell at you if the unixtime is incorrect', t => { | |||
t.throws(() => encoder.unixtime(-1), /positive/); | |||
t.pass(); | |||
}); | |||
test('should be possible to encode a unixtime', t => { | |||
t.deepEqual(encoder.unixtime(base.unixtime), base.unixtimeBytes); | |||
t.pass(); | |||
}); |
@ -1,12 +0,0 @@ | |||
void printByteArrayToHex(byte *arr) { | |||
for(int i = 0; i < sizeof(arr); i++) { | |||
printf("%02x", arr[i]); | |||
} | |||
printf("\n"); | |||
} | |||
void compare_array(byte *arr1, byte *arr2, int start, int len) { | |||
for(int i = start; i < start + len; i++) { | |||
REQUIRE(arr1[i] == arr2[i]); | |||
} | |||
} |
@ -1,11 +0,0 @@ | |||
# This sets the default behaviour, overriding core.autocrlf | |||
* text=auto | |||
# All source files should have unix line-endings in the repository, | |||
# but convert to native line-endings on checkout | |||
*.cpp text | |||
*.h text | |||
*.hpp text | |||
# Windows specific files should retain windows line-endings | |||
*.sln text eol=crlf |
@ -1,29 +0,0 @@ | |||
## Description | |||
<!-- | |||
If your issue is a bugreport, this means describing what you did, | |||
what did you want to happen and what actually did happen. | |||
If your issue is a feature request, describe the feature and why do you | |||
want it. | |||
--> | |||
### Steps to reproduce | |||
<!-- | |||
This is only relevant for bug reports, but if you do have one, | |||
please provide a minimal set of steps to reproduce the problem. | |||
Usually this means providing a small and self-contained code using Catch | |||
and specifying compiler flags/tools used if relevant. | |||
--> | |||
### Extra information | |||
<!-- | |||
Fill in any extra information that might be important for your issue. | |||
If your issue is a bugreport, definitely fill out at least the following. | |||
--> | |||
* Catch version: **v42.42.42** | |||
* Operating System: **Joe's discount operating system** | |||
* Compiler+version: **Hidden Dragon v1.2.3** |
@ -1,25 +0,0 @@ | |||
<!-- | |||
Please do not submit pull requests changing the `version.hpp` | |||
or the single-include `catch.hpp` file, these are changed | |||
only when a new release is made. | |||
--> | |||
## Description | |||
<!-- | |||
Describe the what and the why of your pull request. Remember that these two | |||
are usually a bit different. As an example, if you have made various changes | |||
to decrease the number of new strings allocated, thats what. The why probably | |||
was that you have a large set of tests and found that this speeds them up. | |||
--> | |||
## GitHub Issues | |||
<!-- | |||
If this PR was motivated by some existing issues, reference them here. | |||
If it is a simple bug-fix, please also add a line like 'Closes #123' | |||
to your commit message, so that it is automatically closed. | |||
If it is not, don't, as it might take several iterations for a feature | |||
to be done properly. If in doubt, leave it open and reference it in the | |||
PR itself, so that maintainers can decide. | |||
--> |
@ -1,29 +0,0 @@ | |||
*.build | |||
*.pbxuser | |||
*.mode1v3 | |||
*.ncb | |||
*.suo | |||
Debug | |||
Release | |||
*.user | |||
*.xcuserstate | |||
.DS_Store | |||
xcuserdata | |||
CatchSelfTest.xcscheme | |||
Breakpoints.xcbkptlist | |||
projects/VS2010/TestCatch/_UpgradeReport_Files/ | |||
projects/VS2010/TestCatch/TestCatch/TestCatch.vcxproj.filters | |||
projects/VisualStudio/TestCatch/UpgradeLog.XML | |||
projects/CMake/.idea | |||
projects/CMake/cmake-build-debug | |||
UpgradeLog.XML | |||
Resources/DWARF | |||
projects/Generated | |||
*.pyc | |||
DerivedData | |||
*.xccheckout | |||
Build | |||
.idea | |||
cmake-build-debug | |||
cmake-build-release | |||
.vs |
@ -1,232 +0,0 @@ | |||
language: cpp | |||
sudo: false | |||
matrix: | |||
include: | |||
# 1/ Linux Clang Builds | |||
- os: linux | |||
compiler: clang | |||
addons: &clang34 | |||
apt: | |||
sources: ['llvm-toolchain-precise', 'ubuntu-toolchain-r-test'] | |||
packages: ['clang'] | |||
env: COMPILER='clang++' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: *clang34 | |||
env: COMPILER='clang++' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: &clang35 | |||
apt: | |||
sources: ['llvm-toolchain-precise-3.5', 'ubuntu-toolchain-r-test'] | |||
packages: ['clang-3.5'] | |||
env: COMPILER='clang++-3.5' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: *clang35 | |||
env: COMPILER='clang++-3.5' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: &clang36 | |||
apt: | |||
sources: ['llvm-toolchain-precise-3.6', 'ubuntu-toolchain-r-test'] | |||
packages: ['clang-3.6'] | |||
env: COMPILER='clang++-3.6' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: *clang36 | |||
env: COMPILER='clang++-3.6' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: &clang37 | |||
apt: | |||
sources: ['llvm-toolchain-precise-3.7', 'ubuntu-toolchain-r-test'] | |||
packages: ['clang-3.7'] | |||
env: COMPILER='clang++-3.7' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: *clang37 | |||
env: COMPILER='clang++-3.7' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: &clang38 | |||
apt: | |||
sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test'] | |||
packages: ['clang-3.8'] | |||
env: COMPILER='clang++-3.8' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: clang | |||
addons: *clang38 | |||
env: COMPILER='clang++-3.8' BUILD_TYPE='Debug' CPP11=0 | |||
# 2/ Linux GCC Builds | |||
- os: linux | |||
compiler: gcc | |||
addons: &gcc44 | |||
apt: | |||
sources: ['ubuntu-toolchain-r-test'] | |||
packages: ['g++-4.4'] | |||
env: COMPILER='g++-4.4' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: *gcc44 | |||
env: COMPILER='g++-4.4' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: &gcc47 | |||
apt: | |||
sources: ['ubuntu-toolchain-r-test'] | |||
packages: ['g++-4.7'] | |||
env: COMPILER='g++-4.7' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: *gcc47 | |||
env: COMPILER='g++-4.7' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: &gcc48 | |||
apt: | |||
sources: ['ubuntu-toolchain-r-test'] | |||
packages: ['g++-4.8'] | |||
env: COMPILER='g++-4.8' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: *gcc48 | |||
env: COMPILER='g++-4.8' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: &gcc49 | |||
apt: | |||
sources: ['ubuntu-toolchain-r-test'] | |||
packages: ['g++-4.9'] | |||
env: COMPILER='g++-4.9' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: *gcc49 | |||
env: COMPILER='g++-4.9' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: &gcc5 | |||
apt: | |||
sources: ['ubuntu-toolchain-r-test'] | |||
packages: ['g++-5'] | |||
env: COMPILER='g++-5' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: *gcc5 | |||
env: COMPILER='g++-5' BUILD_TYPE='Debug' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: &gcc6 | |||
apt: | |||
sources: ['ubuntu-toolchain-r-test'] | |||
packages: ['g++-6'] | |||
env: COMPILER='g++-6' BUILD_TYPE='Release' CPP11=0 | |||
- os: linux | |||
compiler: gcc | |||
addons: *gcc6 | |||
env: COMPILER='g++-6' BUILD_TYPE='Debug' CPP11=0 | |||
# 3a/ Linux C++11 GCC builds | |||
- os: linux | |||
compiler: gcc | |||
addons: &gcc48 | |||
apt: | |||
sources: ['ubuntu-toolchain-r-test'] | |||
packages: ['g++-4.8'] | |||
env: COMPILER='g++-4.8' BUILD_TYPE='Release' CPP11=1 | |||
- os: linux | |||
compiler: gcc | |||
addons: *gcc48 | |||
env: COMPILER='g++-4.8' BUILD_TYPE='Debug' CPP11=1 | |||
# 3b/ Linux C++11 Clang builds | |||
- os: linux | |||
compiler: clang | |||
addons: &clang38 | |||
apt: | |||
sources: ['llvm-toolchain-precise-3.8', 'ubuntu-toolchain-r-test'] | |||
packages: ['clang-3.8'] | |||
env: COMPILER='clang++-3.8' BUILD_TYPE='Release' CPP11=1 | |||
- os: linux | |||
compiler: clang | |||
addons: *clang38 | |||
env: COMPILER='clang++-3.8' BUILD_TYPE='Debug' CPP11=1 | |||
# 4/ OSX Clang Builds | |||
- os: osx | |||
osx_image: xcode7.3 | |||
compiler: clang | |||
env: COMPILER='clang++' BUILD_TYPE='Debug' CPP11=0 | |||
- os: osx | |||
osx_image: xcode7.3 | |||
compiler: clang | |||
env: COMPILER='clang++' BUILD_TYPE='Release' CPP11=0 | |||
- os: osx | |||
osx_image: xcode8 | |||
compiler: clang | |||
env: COMPILER='clang++' BUILD_TYPE='Debug' CPP11=0 | |||
- os: osx | |||
osx_image: xcode8 | |||
compiler: clang | |||
env: COMPILER='clang++' BUILD_TYPE='Release' CPP11=0 | |||
install: | |||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps" | |||
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR} | |||
- | | |||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then | |||
CMAKE_URL="http://www.cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz" | |||
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake | |||
export PATH=${DEPS_DIR}/cmake/bin:${PATH} | |||
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then | |||
which cmake || brew install cmake | |||
fi | |||
before_script: | |||
- export CXX=${COMPILER} | |||
- cd ${TRAVIS_BUILD_DIR} | |||
- cmake -H. -BBuild -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -Wdev -DUSE_CPP11=${CPP11} | |||
- cd Build | |||
script: | |||
- make -j 2 | |||
- ctest -V -j 2 |
@ -1,271 +0,0 @@ | |||
cmake_minimum_required(VERSION 3.0) | |||
project(CatchSelfTest) | |||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | |||
# define some folders | |||
set(CATCH_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | |||
set(SELF_TEST_DIR ${CATCH_DIR}/projects/SelfTest) | |||
set(BENCHMARK_DIR ${CATCH_DIR}/projects/Benchmark) | |||
set(HEADER_DIR ${CATCH_DIR}/include) | |||
if(USE_CPP11) | |||
## We can't turn this on by default, since it breaks on travis | |||
message(STATUS "Enabling C++11") | |||
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") | |||
elseif(USE_CPP14) | |||
message(STATUS "Enabling C++14") | |||
set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}") | |||
endif() | |||
#checks that the given hard-coded list contains all headers + sources in the given folder | |||
function(CheckFileList LIST_VAR FOLDER) | |||
set(MESSAGE " should be added to the variable ${LIST_VAR}") | |||
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") | |||
file(GLOB GLOBBED_LIST "${FOLDER}/*.cpp" | |||
"${FOLDER}/*.hpp" | |||
"${FOLDER}/*.h") | |||
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) | |||
foreach(EXTRA_ITEM ${GLOBBED_LIST}) | |||
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") | |||
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") | |||
endforeach() | |||
endfunction() | |||
function(CheckFileListRec LIST_VAR FOLDER) | |||
set(MESSAGE " should be added to the variable ${LIST_VAR}") | |||
set(MESSAGE "${MESSAGE} in ${CMAKE_CURRENT_LIST_FILE}\n") | |||
file(GLOB_RECURSE GLOBBED_LIST "${FOLDER}/*.cpp" | |||
"${FOLDER}/*.hpp" | |||
"${FOLDER}/*.h") | |||
list(REMOVE_ITEM GLOBBED_LIST ${${LIST_VAR}}) | |||
foreach(EXTRA_ITEM ${GLOBBED_LIST}) | |||
string(REPLACE "${CATCH_DIR}/" "" RELATIVE_FILE_NAME "${EXTRA_ITEM}") | |||
message(AUTHOR_WARNING "The file \"${RELATIVE_FILE_NAME}\"${MESSAGE}") | |||
endforeach() | |||
endfunction() | |||
# define the sources of the self test | |||
# Please keep these ordered alphabetically | |||
set(TEST_SOURCES | |||
${SELF_TEST_DIR}/ApproxTests.cpp | |||
${SELF_TEST_DIR}/BDDTests.cpp | |||
${SELF_TEST_DIR}/ClassTests.cpp | |||
${SELF_TEST_DIR}/CmdLineTests.cpp | |||
${SELF_TEST_DIR}/CompilationTests.cpp | |||
${SELF_TEST_DIR}/ConditionTests.cpp | |||
${SELF_TEST_DIR}/EnumToString.cpp | |||
${SELF_TEST_DIR}/ExceptionTests.cpp | |||
${SELF_TEST_DIR}/GeneratorTests.cpp | |||
${SELF_TEST_DIR}/MessageTests.cpp | |||
${SELF_TEST_DIR}/MiscTests.cpp | |||
${SELF_TEST_DIR}/PartTrackerTests.cpp | |||
${SELF_TEST_DIR}/TagAliasTests.cpp | |||
${SELF_TEST_DIR}/TestMain.cpp | |||
${SELF_TEST_DIR}/ToStringGeneralTests.cpp | |||
${SELF_TEST_DIR}/ToStringPair.cpp | |||
${SELF_TEST_DIR}/ToStringTuple.cpp | |||
${SELF_TEST_DIR}/ToStringVector.cpp | |||
${SELF_TEST_DIR}/ToStringWhich.cpp | |||
${SELF_TEST_DIR}/TrickyTests.cpp | |||
${SELF_TEST_DIR}/VariadicMacrosTests.cpp | |||
${SELF_TEST_DIR}/MatchersTests.cpp | |||
) | |||
CheckFileList(TEST_SOURCES ${SELF_TEST_DIR}) | |||
# A set of impl files that just #include a single header | |||
# Please keep these ordered alphabetically | |||
set(IMPL_SOURCES | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_common.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_console_colour.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_debugger.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_capture.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_config.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_exception.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_generators.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_registry_hub.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_reporter.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_runner.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_interfaces_testcase.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_message.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_option.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_ptr.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_stream.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_streambuf.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_test_spec.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_xmlwriter.cpp | |||
${SELF_TEST_DIR}/SurrogateCpps/catch_test_case_tracker.cpp | |||
) | |||
CheckFileList(IMPL_SOURCES ${SELF_TEST_DIR}/SurrogateCpps) | |||
# Please keep these ordered alphabetically | |||
set(TOP_LEVEL_HEADERS | |||
${HEADER_DIR}/catch.hpp | |||
${HEADER_DIR}/catch_session.hpp | |||
${HEADER_DIR}/catch_with_main.hpp | |||
) | |||
CheckFileList(TOP_LEVEL_HEADERS ${HEADER_DIR}) | |||
# Please keep these ordered alphabetically | |||
set(EXTERNAL_HEADERS | |||
${HEADER_DIR}/external/clara.h | |||
${HEADER_DIR}/external/tbc_text_format.h | |||
) | |||
CheckFileList(EXTERNAL_HEADERS ${HEADER_DIR}/external) | |||
# Please keep these ordered alphabetically | |||
set(INTERNAL_HEADERS | |||
${HEADER_DIR}/internal/catch_approx.hpp | |||
${HEADER_DIR}/internal/catch_assertionresult.h | |||
${HEADER_DIR}/internal/catch_assertionresult.hpp | |||
${HEADER_DIR}/internal/catch_capture.hpp | |||
${HEADER_DIR}/internal/catch_clara.h | |||
${HEADER_DIR}/internal/catch_commandline.hpp | |||
${HEADER_DIR}/internal/catch_common.h | |||
${HEADER_DIR}/internal/catch_common.hpp | |||
${HEADER_DIR}/internal/catch_compiler_capabilities.h | |||
${HEADER_DIR}/internal/catch_config.hpp | |||
${HEADER_DIR}/internal/catch_console_colour.hpp | |||
${HEADER_DIR}/internal/catch_console_colour_impl.hpp | |||
${HEADER_DIR}/internal/catch_context.h | |||
${HEADER_DIR}/internal/catch_context_impl.hpp | |||
${HEADER_DIR}/internal/catch_debugger.h | |||
${HEADER_DIR}/internal/catch_debugger.hpp | |||
${HEADER_DIR}/internal/catch_default_main.hpp | |||
${HEADER_DIR}/internal/catch_evaluate.hpp | |||
${HEADER_DIR}/internal/catch_exception_translator_registry.hpp | |||
${HEADER_DIR}/internal/catch_expression_lhs.hpp | |||
${HEADER_DIR}/internal/catch_fatal_condition.hpp | |||
${HEADER_DIR}/internal/catch_generators.hpp | |||
${HEADER_DIR}/internal/catch_generators_impl.hpp | |||
${HEADER_DIR}/internal/catch_impl.hpp | |||
${HEADER_DIR}/internal/catch_interfaces_capture.h | |||
${HEADER_DIR}/internal/catch_interfaces_config.h | |||
${HEADER_DIR}/internal/catch_interfaces_exception.h | |||
${HEADER_DIR}/internal/catch_interfaces_generators.h | |||
${HEADER_DIR}/internal/catch_interfaces_registry_hub.h | |||
${HEADER_DIR}/internal/catch_interfaces_reporter.h | |||
${HEADER_DIR}/internal/catch_interfaces_runner.h | |||
${HEADER_DIR}/internal/catch_interfaces_tag_alias_registry.h | |||
${HEADER_DIR}/internal/catch_interfaces_testcase.h | |||
${HEADER_DIR}/internal/catch_legacy_reporter_adapter.h | |||
${HEADER_DIR}/internal/catch_legacy_reporter_adapter.hpp | |||
${HEADER_DIR}/internal/catch_list.hpp | |||
${HEADER_DIR}/internal/catch_matchers.hpp | |||
${HEADER_DIR}/internal/catch_matchers_string.h | |||
${HEADER_DIR}/internal/catch_matchers_string.hpp | |||
${HEADER_DIR}/internal/catch_matchers_vector.h | |||
${HEADER_DIR}/internal/catch_message.h | |||
${HEADER_DIR}/internal/catch_message.hpp | |||
${HEADER_DIR}/internal/catch_notimplemented_exception.h | |||
${HEADER_DIR}/internal/catch_notimplemented_exception.hpp | |||
${HEADER_DIR}/internal/catch_objc.hpp | |||
${HEADER_DIR}/internal/catch_objc_arc.hpp | |||
${HEADER_DIR}/internal/catch_option.hpp | |||
${HEADER_DIR}/internal/catch_platform.h | |||
${HEADER_DIR}/internal/catch_ptr.hpp | |||
${HEADER_DIR}/internal/catch_reenable_warnings.h | |||
${HEADER_DIR}/internal/catch_registry_hub.hpp | |||
${HEADER_DIR}/internal/catch_reporter_registrars.hpp | |||
${HEADER_DIR}/internal/catch_reporter_registry.hpp | |||
${HEADER_DIR}/internal/catch_result_builder.h | |||
${HEADER_DIR}/internal/catch_result_builder.hpp | |||
${HEADER_DIR}/internal/catch_result_type.h | |||
${HEADER_DIR}/internal/catch_run_context.hpp | |||
${HEADER_DIR}/internal/catch_section.h | |||
${HEADER_DIR}/internal/catch_section.hpp | |||
${HEADER_DIR}/internal/catch_section_info.h | |||
${HEADER_DIR}/internal/catch_section_info.hpp | |||
${HEADER_DIR}/internal/catch_stream.h | |||
${HEADER_DIR}/internal/catch_stream.hpp | |||
${HEADER_DIR}/internal/catch_streambuf.h | |||
${HEADER_DIR}/internal/catch_suppress_warnings.h | |||
${HEADER_DIR}/internal/catch_tag_alias.h | |||
${HEADER_DIR}/internal/catch_tag_alias_registry.h | |||
${HEADER_DIR}/internal/catch_tag_alias_registry.hpp | |||
${HEADER_DIR}/internal/catch_test_case_info.h | |||
${HEADER_DIR}/internal/catch_test_case_info.hpp | |||
${HEADER_DIR}/internal/catch_test_case_registry_impl.hpp | |||
${HEADER_DIR}/internal/catch_test_case_tracker.hpp | |||
${HEADER_DIR}/internal/catch_test_registry.hpp | |||
${HEADER_DIR}/internal/catch_test_spec.hpp | |||
${HEADER_DIR}/internal/catch_test_spec_parser.hpp | |||
${HEADER_DIR}/internal/catch_text.h | |||
${HEADER_DIR}/internal/catch_timer.h | |||
${HEADER_DIR}/internal/catch_timer.hpp | |||
${HEADER_DIR}/internal/catch_tostring.h | |||
${HEADER_DIR}/internal/catch_tostring.hpp | |||
${HEADER_DIR}/internal/catch_totals.hpp | |||
${HEADER_DIR}/internal/catch_type_traits.hpp | |||
${HEADER_DIR}/internal/catch_version.h | |||
${HEADER_DIR}/internal/catch_version.hpp | |||
${HEADER_DIR}/internal/catch_wildcard_pattern.hpp | |||
${HEADER_DIR}/internal/catch_windows_h_proxy.h | |||
${HEADER_DIR}/internal/catch_xmlwriter.hpp | |||
) | |||
CheckFileList(INTERNAL_HEADERS ${HEADER_DIR}/internal) | |||
# Please keep these ordered alphabetically | |||
set(REPORTER_HEADERS | |||
${HEADER_DIR}/reporters/catch_reporter_automake.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_bases.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_compact.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_console.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_junit.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_multi.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_tap.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_teamcity.hpp | |||
${HEADER_DIR}/reporters/catch_reporter_xml.hpp | |||
) | |||
CheckFileList(REPORTER_HEADERS ${HEADER_DIR}/reporters) | |||
# Specify the headers, too, so CLion recognises them as project files | |||
set(HEADERS | |||
${TOP_LEVEL_HEADERS} | |||
${EXTERNAL_HEADERS} | |||
${INTERNAL_HEADERS} | |||
${REPORTER_HEADERS} | |||
) | |||
set(BENCH_SOURCES | |||
${BENCHMARK_DIR}/BenchMain.cpp | |||
${BENCHMARK_DIR}/StringificationBench.cpp | |||
) | |||
CheckFileList(BENCH_SOURCES ${BENCHMARK_DIR}) | |||
# Provide some groupings for IDEs | |||
SOURCE_GROUP("Tests" FILES ${TEST_SOURCES}) | |||
SOURCE_GROUP("Surrogates" FILES ${IMPL_SOURCES}) | |||
SOURCE_GROUP("Benchmarks" FILES ${BENCH_SOURCES}) | |||
# configure the executable | |||
include_directories(${HEADER_DIR}) | |||
add_executable(SelfTest ${TEST_SOURCES} ${IMPL_SOURCES} ${HEADERS}) | |||
add_executable(Benchmark ${BENCH_SOURCES} ${HEADERS}) | |||
# Add desired warnings | |||
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang|GNU" ) | |||
target_compile_options( SelfTest PRIVATE -Wall -Wextra ) | |||
target_compile_options( Benchmark PRIVATE -Wall -Wextra ) | |||
endif() | |||
if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" ) | |||
target_compile_options( SelfTest PRIVATE /W4 ) | |||
target_compile_options( Benchmark PRIVATE /W4 ) | |||
endif() | |||
# configure unit tests via CTest | |||
enable_testing() | |||
add_test(NAME RunTests COMMAND SelfTest) | |||
add_test(NAME ListTests COMMAND SelfTest --list-tests) | |||
set_tests_properties(ListTests PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ test cases") | |||
add_test(NAME ListTags COMMAND SelfTest --list-tags) | |||
set_tests_properties(ListTags PROPERTIES PASS_REGULAR_EXPRESSION "[0-9]+ tags") | |||
install(DIRECTORY "single_include/" DESTINATION "include/catch/") |
@ -1,23 +0,0 @@ | |||
Boost Software License - Version 1.0 - August 17th, 2003 | |||
Permission is hereby granted, free of charge, to any person or organization | |||
obtaining a copy of the software and accompanying documentation covered by | |||
this license (the "Software") to use, reproduce, display, distribute, | |||
execute, and transmit the Software, and to prepare derivative works of the | |||
Software, and to permit third-parties to whom the Software is furnished to | |||
do so, all subject to the following: | |||
The copyright notices in the Software and this entire statement, including | |||
the above license grant, this restriction and the following disclaimer, | |||
must be included in all copies of the Software, in whole or in part, and | |||
all derivative works of the Software, unless such copies or derivative | |||
works are solely in the form of machine-executable object code generated by | |||
a source language processor. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT | |||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE | |||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, | |||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |||
DEALINGS IN THE SOFTWARE. |
@ -1,23 +0,0 @@ | |||
 | |||
[](https://github.com/philsquared/catch/releases) | |||
[](https://travis-ci.org/philsquared/Catch) | |||
[](https://ci.appveyor.com/project/philsquared/catch/branch/master) | |||
<a href="https://github.com/philsquared/Catch/releases/download/v1.8.1/catch.hpp">The latest, single header, version can be downloaded directly using this link</a> | |||
## What's the Catch? | |||
Catch stands for C++ Automated Test Cases in Headers and is a multi-paradigm automated test framework for C++ and Objective-C (and, maybe, C). It is implemented entirely in a set of header files, but is packaged up as a single header for extra convenience. | |||
## How to use it | |||
This documentation comprises these three parts: | |||
* [Why do we need yet another C++ Test Framework?](docs/why-catch.md) | |||
* [Tutorial](docs/tutorial.md) - getting started | |||
* [Reference section](docs/Readme.md) - all the details | |||
## More | |||
* Issues and bugs can be raised on the [Issue tracker on GitHub](https://github.com/philsquared/Catch/issues) | |||
* For discussion or questions please use [the dedicated Google Groups forum](https://groups.google.com/forum/?fromgroups#!forum/catch-forum) | |||
* See [who else is using Catch](docs/opensource-users.md) |
@ -1,45 +0,0 @@ | |||
# version string format -- This will be overwritten later anyway | |||
version: "{build}" | |||
# Disable the dead branch for v2 development | |||
branches: | |||
except: | |||
- develop-v2 | |||
os: | |||
- Visual Studio 2013 | |||
- Visual Studio 2015 | |||
init: | |||
- git config --global core.autocrlf input | |||
# Set build version to git commit-hash | |||
- ps: Update-AppveyorBuild -Version "$($env:APPVEYOR_REPO_BRANCH) - $($env:APPVEYOR_REPO_COMMIT)" | |||
# fetch repository as zip archive | |||
shallow_clone: true | |||
# Win32 and x64 are CMake-compatible solution platform names. | |||
# This allows us to pass %PLATFORM% to CMake -A. | |||
platform: | |||
- Win32 | |||
- x64 | |||
# build Configurations, i.e. Debug, Release, etc. | |||
configuration: | |||
- Debug | |||
- Release | |||
#Cmake will autodetect the compiler, but we set the arch | |||
before_build: | |||
- echo Running cmake... | |||
- cmake -H. -BBuild -A%PLATFORM% | |||
# build with MSBuild | |||
build: | |||
project: Build\CatchSelfTest.sln # path to Visual Studio solution or project | |||
parallel: true # enable MSBuild parallel builds | |||
verbosity: normal # MSBuild verbosity level {quiet|minimal|normal|detailed} | |||
test_script: | |||
- cd Build | |||
- ctest -V -j 2 -C %CONFIGURATION% |
@ -1,23 +0,0 @@ | |||
These are the currently documented areas of the framework. There is more to come. | |||
Before looking at this material be sure to read the [tutorial](tutorial.md) | |||
* [Assertion macros](assertions.md) | |||
* [Matchers](matchers.md) | |||
* [Logging macros](logging.md) | |||
* [Test cases and sections](test-cases-and-sections.md) | |||
* [Test fixtures](test-fixtures.md) | |||
* [Command line](command-line.md) | |||
* [Build systems](build-systems.md) | |||
* [Supplying your own main()](own-main.md) | |||
* [Configuration](configuration.md) | |||
* [String Conversions](tostring.md) | |||
* [Why are my tests slow to compile?](slow-compiles.md) | |||
* [Known limitations](limitations.md) | |||
Other | |||
* [Why Catch?](why-catch.md) | |||
* [Open Source Projects using Catch](opensource-users.md) | |||
* [Contributing](contributing.md) | |||
* [Release Notes](release-notes.md) |
@ -1,136 +0,0 @@ | |||
# Assertion Macros | |||
Most test frameworks have a large collection of assertion macros to capture all possible conditional forms (```_EQUALS```, ```_NOTEQUALS```, ```_GREATER_THAN``` etc). | |||
Catch is different. Because it decomposes natural C-style conditional expressions most of these forms are reduced to one or two that you will use all the time. That said there are a rich set of auxilliary macros as well. We'll describe all of these here. | |||
Most of these macros come in two forms: | |||
## Natural Expressions | |||
The ```REQUIRE``` family of macros tests an expression and aborts the test case if it fails. | |||
The ```CHECK``` family are equivalent but execution continues in the same test case even if the assertion fails. This is useful if you have a series of essentially orthogonal assertions and it is useful to see all the results rather than stopping at the first failure. | |||
* **REQUIRE(** _expression_ **)** and | |||
* **CHECK(** _expression_ **)** | |||
Evaluates the expression and records the result. If an exception is thrown it is caught, reported, and counted as a failure. These are the macros you will use most of the time | |||
Examples: | |||
``` | |||
CHECK( str == "string value" ); | |||
CHECK( thisReturnsTrue() ); | |||
REQUIRE( i == 42 ); | |||
``` | |||
* **REQUIRE_FALSE(** _expression_ **)** and | |||
* **CHECK_FALSE(** _expression_ **)** | |||
Evaluates the expression and records the _logical NOT_ of the result. If an exception is thrown it is caught, reported, and counted as a failure. | |||
(these forms exist as a workaround for the fact that ! prefixed expressions cannot be decomposed). | |||
Example: | |||
``` | |||
REQUIRE_FALSE( thisReturnsFalse() ); | |||
``` | |||
Do note that "overly complex" expressions cannot be decomposed and thus will not compile. This is done partly for practical reasons (to keep the underlying expression template machinery to minimum) and partly for philosophical reasons (assertions should be simple and deterministic). | |||
Examples: | |||
* `CHECK(a == 1 && b == 2);` | |||
This expression is too complex because of the `&&` operator. If you want to check that 2 or more properties hold, you can either put the expression into parenthesis, which stops decomposition from working, or you need to decompose the expression into two assertions: `CHECK( a == 1 ); CHECK( b == 2);` | |||
* `CHECK( a == 2 || b == 1 );` | |||
This expression is too complex because of the `||` operator. If you want to check that one of several properties hold, you can put the expression into parenthesis (unlike with `&&`, expression decomposition into several `CHECK`s is not possible). | |||
### Floating point comparisons | |||
When comparing floating point numbers - especially if at least one of them has been computed - great care must be taken to allow for rounding errors and inexact representations. | |||
Catch provides a way to perform tolerant comparisons of floating point values through use of a wrapper class called ```Approx```. ```Approx``` can be used on either side of a comparison expression. It overloads the comparisons operators to take a tolerance into account. Here's a simple example: | |||