diff --git a/.all-contributorsrc b/.all-contributorsrc
new file mode 100644
index 0000000..4f9c925
--- /dev/null
+++ b/.all-contributorsrc
@@ -0,0 +1,53 @@
+{
+ "files": [
+ "README.md"
+ ],
+ "imageSize": 100,
+ "commit": false,
+ "contributors": [
+ {
+ "login": "CodyDWJones",
+ "name": "CodyDWJones",
+ "avatar_url": "https://avatars.githubusercontent.com/u/28773740?v=4",
+ "profile": "https://github.com/CodyDWJones",
+ "contributions": [
+ "code",
+ "maintenance"
+ ]
+ },
+ {
+ "login": "janisozaur",
+ "name": "Michał Janiszewski",
+ "avatar_url": "https://avatars.githubusercontent.com/u/550290?v=4",
+ "profile": "https://github.com/janisozaur",
+ "contributions": [
+ "code",
+ "maintenance"
+ ]
+ },
+ {
+ "login": "tirpidz",
+ "name": "Martin Turcotte",
+ "avatar_url": "https://avatars.githubusercontent.com/u/9991876?v=4",
+ "profile": "https://github.com/tirpidz",
+ "contributions": [
+ "maintenance"
+ ]
+ },
+ {
+ "login": "Meradrin",
+ "name": "Meradrin",
+ "avatar_url": "https://avatars.githubusercontent.com/u/7066278?v=4",
+ "profile": "https://github.com/Meradrin",
+ "contributions": [
+ "bug"
+ ]
+ }
+ ],
+ "contributorsPerLine": 7,
+ "projectName": "sjson-cpp",
+ "projectOwner": "nfrechette",
+ "repoType": "github",
+ "repoHost": "https://github.com",
+ "skipCi": true
+}
diff --git a/.editorconfig b/.editorconfig
index 153e002..2245211 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -5,11 +5,16 @@ end_of_line = lf
insert_final_newline = true
# Matches multiple files with brace expansion notation
-[*.{cpp,h,py,txt}]
+[*.{cpp,h,py,cmake,txt,java}]
charset = utf-8
indent_style = tab
indent_size = 4
trim_trailing_whitespace = true
[*.md]
-trim_trailing_whitespace = false
\ No newline at end of file
+trim_trailing_whitespace = false
+
+[*.{gradle,gradle.in}]
+indent_style = space
+indent_size = 4
+trim_trailing_whitespace = true
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 0000000..724e02b
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1,14 @@
+# These are supported funding model platforms
+
+#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
+#patreon: # Replace with a single Patreon username
+#open_collective: # Replace with a single Open Collective username
+#ko_fi: # Replace with a single Ko-fi username
+#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
+#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
+#liberapay: # Replace with a single Liberapay username
+#issuehunt: # Replace with a single IssueHunt username
+#otechie: # Replace with a single Otechie username
+#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
+
+github: [nfrechette]
diff --git a/.github/workflows/build_pull_request.yml b/.github/workflows/build_pull_request.yml
new file mode 100644
index 0000000..17cf981
--- /dev/null
+++ b/.github/workflows/build_pull_request.yml
@@ -0,0 +1,169 @@
+name: build pull request
+
+on:
+ pull_request:
+ branches:
+ - '**'
+ paths-ignore:
+ - '**/*.md'
+
+jobs:
+ linux-lunar:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ compiler: [gcc12, gcc13, clang15, clang16, clang17, clang18]
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Building (debug-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x86 -build'
+ - name: Running unit tests (debug-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x86 -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (debug-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x64 -build'
+ - name: Running unit tests (debug-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x64 -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (release-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x86 -build'
+ - name: Running unit tests (release-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x86 -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (release-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x64 -build'
+ - name: Running unit tests (release-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x64 -unit_test'
+
+ osx-14:
+ runs-on: macos-14
+ strategy:
+ matrix:
+ compiler: [xcode15, xcode16]
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Setup ${{ matrix.compiler }} compiler
+ run: ./tools/setup_osx_compiler.sh ${{ matrix.compiler }}
+ - name: Building (debug-arm64)
+ run: python3 make.py -ci -compiler osx -config Debug -build
+ - name: Running unit tests (debug-arm64)
+ run: python3 make.py -ci -compiler osx -config Debug -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-arm64)
+ run: python3 make.py -ci -compiler osx -config Release -build
+ - name: Running unit tests (release-arm64)
+ run: python3 make.py -ci -compiler osx -config Release -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building for iOS (debug-arm64)
+ run: python3 make.py -ci -compiler ios -config Debug -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building for iOS (release-arm64)
+ run: python3 make.py -ci -compiler ios -config Release -build
+
+ emscripten:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Building (debug)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config debug -build'
+ - name: Running unit tests (debug)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config debug -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (release)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config release -build'
+ - name: Running unit tests (release)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config release -unit_test'
+
+ vs2022:
+ runs-on: windows-2022
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Building (debug-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu x64 -build
+ - name: Running unit tests (debug-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu x64 -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu x64 -build
+ - name: Running unit tests (release-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu x64 -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (debug-arm64)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu arm64 -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-arm64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu arm64 -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (debug-arm64)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu arm64ec -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-arm64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu arm64ec -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (debug-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Debug -cpu x64 -build
+ - name: Running unit tests (debug-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Debug -cpu x64 -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Release -cpu x64 -build
+ - name: Running unit tests (release-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Release -cpu x64 -unit_test
diff --git a/.github/workflows/build_push.yml b/.github/workflows/build_push.yml
new file mode 100644
index 0000000..2ff50ed
--- /dev/null
+++ b/.github/workflows/build_push.yml
@@ -0,0 +1,169 @@
+name: build push
+
+on:
+ push:
+ branches:
+ - '**'
+ paths-ignore:
+ - '**/*.md'
+
+jobs:
+ linux:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ compiler: [gcc13, clang18]
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Building (debug-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x86 -build'
+ - name: Running unit tests (debug-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x86 -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (debug-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x64 -build'
+ - name: Running unit tests (debug-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Debug -cpu x64 -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (release-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x86 -build'
+ - name: Running unit tests (release-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x86 -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (release-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x64 -build'
+ - name: Running unit tests (release-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x64 -unit_test'
+
+ osx-14:
+ runs-on: macos-14
+ strategy:
+ matrix:
+ compiler: [xcode15]
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Setup ${{ matrix.compiler }} compiler
+ run: ./tools/setup_osx_compiler.sh ${{ matrix.compiler }}
+ - name: Building (debug-arm64)
+ run: python3 make.py -ci -compiler osx -config Debug -build
+ - name: Running unit tests (debug-arm64)
+ run: python3 make.py -ci -compiler osx -config Debug -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-arm64)
+ run: python3 make.py -ci -compiler osx -config Release -build
+ - name: Running unit tests (release-arm64)
+ run: python3 make.py -ci -compiler osx -config Release -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building for iOS (debug-arm64)
+ run: python3 make.py -ci -compiler ios -config Debug -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building for iOS (release-arm64)
+ run: python3 make.py -ci -compiler ios -config Release -build
+
+ emscripten:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Building (debug)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config debug -build'
+ - name: Running unit tests (debug)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config debug -unit_test'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (release)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config release -build'
+ - name: Running unit tests (release)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-emscripten:v1
+ with:
+ args: 'python3 make.py -ci -compiler emscripten -config release -unit_test'
+
+ vs2022:
+ runs-on: windows-2022
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Building (debug-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu x64 -build
+ - name: Running unit tests (debug-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu x64 -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu x64 -build
+ - name: Running unit tests (release-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu x64 -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (debug-arm64)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu arm64 -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-arm64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu arm64 -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (debug-arm64ec)
+ run: python3 make.py -ci -compiler vs2022 -config Debug -cpu arm64ec -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-arm64ec)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu arm64ec -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (debug-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Debug -cpu x64 -build
+ - name: Running unit tests (debug-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Debug -cpu x64 -unit_test
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Release -cpu x64 -build
+ - name: Running unit tests (release-x64) with Clang
+ run: python3 make.py -ci -compiler vs2022-clang -config Release -cpu x64 -unit_test
diff --git a/.github/workflows/msvc-analysis.yml b/.github/workflows/msvc-analysis.yml
new file mode 100644
index 0000000..7743c00
--- /dev/null
+++ b/.github/workflows/msvc-analysis.yml
@@ -0,0 +1,52 @@
+name: msvc analysis
+
+on:
+ pull_request:
+ branches:
+ - '**'
+ paths-ignore:
+ - '**/*.md'
+
+jobs:
+ # We use the presence of the sonar token to detect if the PR comes from a fork
+ condition-check:
+ runs-on: ubuntu-latest
+ outputs:
+ ok: ${{ steps.check-secrets.outputs.ok }}
+ steps:
+ - name: Secret guard
+ id: check-secrets
+ run: |
+ if [ ! -z "${{ secrets.SONAR_TOKEN }}" ]; then
+ echo "ok=true" >> $GITHUB_OUTPUT
+ fi
+ vs2022:
+ needs:
+ - condition-check
+ runs-on: windows-2022
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Generate solution (release-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu x64
+ - name: Run MSVC Code Analysis
+ uses: microsoft/msvc-code-analysis-action@v0.1.1
+ id: run-analysis
+ with:
+ cmakeBuildDirectory: ${{ github.workspace }}/build
+ buildConfiguration: Release
+ ruleset: NativeRecommendedRules.ruleset
+ ignoredPaths: ${{ github.workspace }}/external
+ - name: Upload SARIF to GitHub
+ # Can only upload SARIF if we don't come from a fork
+ if: ${{ needs.condition-check.outputs.ok == 'true' }}
+ uses: github/codeql-action/upload-sarif@v3
+ with:
+ sarif_file: ${{ steps.run-analysis.outputs.sarif }}
+ - name: Upload SARIF as an Artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: sarif-file
+ path: ${{ steps.run-analysis.outputs.sarif }}
diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
new file mode 100644
index 0000000..31a3b60
--- /dev/null
+++ b/.github/workflows/sonarcloud.yml
@@ -0,0 +1,48 @@
+name: sonarcloud
+
+on:
+ push:
+ branches:
+ - '**'
+ paths-ignore:
+ - '**/*.md'
+ pull_request:
+ branches:
+ - '**'
+ paths-ignore:
+ - '**/*.md'
+
+jobs:
+ condition-check:
+ runs-on: ubuntu-latest
+ outputs:
+ ok: ${{ steps.check-secrets.outputs.ok }}
+ steps:
+ - name: Secret guard
+ id: check-secrets
+ run: |
+ if [ ! -z "${{ secrets.SONAR_TOKEN }}" ]; then
+ echo "ok=true" >> $GITHUB_OUTPUT
+ fi
+ sonarcloud:
+ needs:
+ - condition-check
+ if: ${{ needs.condition-check.outputs.ok == 'true' }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v4
+ with:
+ submodules: 'recursive'
+ - name: Build with wrapper
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-sonarcloud:v3
+ with:
+ args: '/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir bw_output python3 make.py -compiler clang15 -config Release -cpu x64 -build'
+ - name: Run Sonar Scanner and upload to Sonarcloud
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: https://sonarcloud.io
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-linux-sonarcloud:v3
+ with:
+ args: '/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner'
diff --git a/.github/workflows/test_cpp_versions.yml b/.github/workflows/test_cpp_versions.yml
new file mode 100644
index 0000000..5e2d625
--- /dev/null
+++ b/.github/workflows/test_cpp_versions.yml
@@ -0,0 +1,54 @@
+name: test cpp versions
+
+on:
+ pull_request:
+ branches:
+ - '**'
+ paths-ignore:
+ - '**/*.md'
+
+jobs:
+ linux:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ compiler: [gcc13, clang18]
+ cpp_version: [14, 17, 20]
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: 'recursive'
+ - name: Building (release-x86)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x86 -cpp_version ${{ matrix.cpp_version }} -build'
+ - name: Clean
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -clean_only'
+ - name: Building (release-x64)
+ uses: docker://ghcr.io/nfrechette/toolchain-amd64-lunar:v2
+ with:
+ args: 'python3 make.py -ci -compiler ${{ matrix.compiler }} -config Release -cpu x64 -cpp_version ${{ matrix.cpp_version }} -build'
+
+ vs2022:
+ runs-on: windows-2022
+ strategy:
+ matrix:
+ cpp_version: [14, 17, 20]
+ steps:
+ - name: Git checkout
+ uses: actions/checkout@v3
+ with:
+ submodules: 'recursive'
+ - name: Building (release-x86)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu x86 -cpp_version ${{ matrix.cpp_version }} -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-x64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu x64 -cpp_version ${{ matrix.cpp_version }} -build
+ - name: Clean
+ run: python3 make.py -clean_only
+ - name: Building (release-arm64)
+ run: python3 make.py -ci -compiler vs2022 -config Release -cpu arm64 -cpp_version ${{ matrix.cpp_version }} -build
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..fe59bc7
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "external/catch2"]
+ path = external/catch2
+ url = https://github.com/catchorg/Catch2
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 5ecca9b..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-dist: trusty
-sudo: required
-
-language: cpp
-
-matrix:
- include:
- # Linux gcc5
- - os: linux
- env: COMPILER=gcc5 PACKAGES="g++-5 g++-5-multilib g++-multilib"
-
- # Linux gcc6
- - os: linux
- env: COMPILER=gcc6 PACKAGES="g++-6 g++-6-multilib g++-multilib"
-
- # Linux gcc7
- - os: linux
- env: COMPILER=gcc7 PACKAGES="g++-7 g++-7-multilib g++-multilib"
-
- # Linux gcc8
- - os: linux
- env: COMPILER=gcc8 PACKAGES="g++-8 g++-8-multilib g++-multilib"
-
- # Linux clang4
- - os: linux
- env: COMPILER=clang4 PACKAGES="clang-4.0 libstdc++-5-dev libc6-dev-i386 g++-5-multilib g++-multilib"
-
- # Linux clang5
- - os: linux
- env: COMPILER=clang5 PACKAGES="clang-5.0 libstdc++-5-dev libc6-dev-i386 g++-5-multilib g++-multilib"
-
- # Linux clang6
- - os: linux
- env: COMPILER=clang6 PACKAGES="clang-6.0 libstdc++-5-dev libc6-dev-i386 g++-5-multilib g++-multilib"
-
- # OS X xcode8
- - os: osx
- osx_image: xcode8.3
- env: COMPILER=osx
-
- # OS X xcode9
- - os: osx
- osx_image: xcode9.4
- env: COMPILER=osx
-
- # OS X xcode10
- - os: osx
- osx_image: xcode10
- env: COMPILER=osx
-
-before_install:
- - if [ "$COMPILER" = "clang4" ]; then curl -sSL "http://apt.llvm.org/llvm-snapshot.gpg.key" | sudo -E apt-key add - ; fi
- - if [ "$COMPILER" = "clang4" ]; then echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-4.0 main" | sudo tee -a /etc/apt/sources.list > /dev/null ; fi
- - if [ "$COMPILER" = "clang5" ]; then curl -sSL "http://apt.llvm.org/llvm-snapshot.gpg.key" | sudo -E apt-key add - ; fi
- - if [ "$COMPILER" = "clang5" ]; then echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-5.0 main" | sudo tee -a /etc/apt/sources.list > /dev/null ; fi
- - if [ "$COMPILER" = "clang6" ]; then curl -sSL "http://apt.llvm.org/llvm-snapshot.gpg.key" | sudo -E apt-key add - ; fi
- - if [ "$COMPILER" = "clang6" ]; then echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-6.0 main" | sudo tee -a /etc/apt/sources.list > /dev/null ; fi
- - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" ; fi
- - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo -E apt-get -yq update ; fi
- - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install ${PACKAGES} ; fi
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew upgrade python || true ; fi
-
-script:
- - python3 make.py -clean -build -unit_test -${COMPILER} -Debug -x86
- - python3 make.py -clean -build -unit_test -${COMPILER} -Release -x86
- - python3 make.py -clean -build -unit_test -${COMPILER} -Debug -x64
- - python3 make.py -clean -build -unit_test -${COMPILER} -Release -x64
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python3 make.py -clean -build -ios -Debug ; fi
- - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then python3 make.py -clean -build -ios -Release; fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5fe4008..d3c02eb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,54 @@
# Significant changes per release
+## 0.9.0
+
+* Added support for Clang 12, 13, 14, and 15
+* Added support for GCC 11, 12, and 13
+* Added support for XCode 14
+* Added support for VS2022
+* Added support for MSYS2
+* Added support for C++14, C++17, and C++20
+* CI now uses docker where possible
+* Lots of static analysis fixes and improvements
+* Misc minor improvements
+
+## 0.8.3
+
+* Force macro expansion in version namespace identifier
+
+## 0.8.2
+
+* Add versioned namespace to allow multiple versions to coexist within a binary
+* Add OS X/Linux ARM development support
+* Other minor changes
+
+## 0.8.1
+
+* Minor static analysis fixes
+
+## 0.8.0
+
+* Added support for clang 8, 9, and 10
+* Added support for GCC 10
+* Added support for clang with VS 2019
+* Added support for emscripten
+* Converted android to use gradle instead of NVIDIA CodeWorks
+* Updated Catch2 to 2.11.0
+* Migrated from Travis to GitHub Actions
+* Cleanup and minor misc changes
+
+## 0.7.0
+
+* Added support for VS 2019, GCC 9, clang 7, and Xcode 11
+* Added custom support for NaN/Inf handling
+* Cleanup and minor misc changes
+
+## 0.6.0
+
+* Added support for Windows ARM64, GCC 8, clang 6, and Xcode 10
+* Integrated SonarCloud
+* Cleanup and minor changes & fixes
+
## 0.5.0
* Cleaned up error handling
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ea1fd4a..093bca7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.2)
+cmake_minimum_required(VERSION 3.2...3.25)
project(sjson-cpp CXX)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
@@ -8,13 +8,21 @@ include(CMakeCompiler)
include(CMakePlatforms)
set(CPU_INSTRUCTION_SET false CACHE STRING "CPU instruction set")
+set(IS_CROSS_COMPILING false CACHE BOOL "Whether we are cross-compiling or not")
+
+if(CMAKE_CONFIGURATION_TYPES)
+ set(CMAKE_CONFIGURATION_TYPES Debug Release)
+ set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
+endif()
# Grab all of our include files
file(GLOB_RECURSE SJSON_CPP_INCLUDE_FILES LIST_DIRECTORIES false
${PROJECT_SOURCE_DIR}/includes/*.h
${PROJECT_SOURCE_DIR}/*.md
${PROJECT_SOURCE_DIR}/cmake/*.cmake
- ${PROJECT_SOURCE_DIR}/tools/vs_visualizers/*.natvis)
+ ${PROJECT_SOURCE_DIR}/tools/release_scripts/*.py
+ ${PROJECT_SOURCE_DIR}/tools/vs_visualizers/*.natvis
+ )
create_source_groups("${SJSON_CPP_INCLUDE_FILES}" ${PROJECT_SOURCE_DIR})
@@ -23,13 +31,9 @@ file(GLOB SJSON_CPP_ROOT_FILES LIST_DIRECTORIES false
${PROJECT_SOURCE_DIR}/*.py)
# Create a dummy target so they show up in the IDE
-add_custom_target(sjson-cpp SOURCES ${SJSON_CPP_INCLUDE_FILES} ${SJSON_CPP_ROOT_FILES})
-
-if(CMAKE_CONFIGURATION_TYPES)
- set(CMAKE_CONFIGURATION_TYPES Debug Release)
- set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
-endif()
+add_custom_target(${PROJECT_NAME} SOURCES ${SJSON_CPP_INCLUDE_FILES} ${SJSON_CPP_ROOT_FILES})
+# Enable CTest
enable_testing()
# Add other projects
diff --git a/README.md b/README.md
index f7b8f38..16ca01a 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
[](https://cla-assistant.io/nfrechette/sjson-cpp)
-[](https://ci.appveyor.com/project/nfrechette/sjson-cpp)
-[](https://travis-ci.org/nfrechette/sjson-cpp)
+[](#contributors-)
+[](https://github.com/nfrechette/sjson-cpp/actions/workflows/build_push.yml)
+[](https://sonarcloud.io/dashboard?id=nfrechette_sjson-cpp)
[](https://github.com/nfrechette/sjson-cpp/releases)
[](https://raw.githubusercontent.com/nfrechette/sjson-cpp/master/LICENSE)
-# SJSON CPP
+# sjson-cpp
`sjson-cpp` is a C++ library to read and write [Simplified JSON](http://help.autodesk.com/view/Stingray/ENU/?guid=__stingray_help_managing_content_sjson_html) files.
It aims to be minimal, fast, and get out of the way of the programmer.
@@ -34,13 +35,15 @@ Unicode formats other than UTF-8 aren't supported.
## Supported platforms
-* Windows (VS2015, VS2017) x86 and x64
-* Linux (gcc5, gcc6, gcc7, gcc8, clang4, clang5, clang6) x86 and x64
-* OS X (Xcode 8.3, Xcode 9.4, Xcode 10) x86 and x64
-* Android (NVIDIA CodeWorks) ARMv7-A
-* iOS (Xcode 8.3, Xcode 9.4, Xcode 10) ARM64
+Continuous integration tests a variety of platforms and configurations but it generally runs as-is anywhere where C++11 (or later) is supported. CI currently tests:
-The above supported platform list is only what is tested every release but if it compiles, it should run just fine.
+* Windows VS2022: x86, x64, ARM64, ARM64EC
+* Linux GCC 12+: x86, x64
+* Linux Clang 15+: x86, x64
+* OS X XCode 15+: ARM64
+* Emscripten 1.39.11: WASM
+
+Each releases is also manually tested on iOS and Android.
## External dependencies
@@ -49,22 +52,38 @@ See [here](./external) for details.
## Getting up and running
-### Windows, Linux, and OS X
+This library is **100%** headers as such you just need to include them in your own project to start using it. However, if you wish to run the unit tests you will need a few things, see below.
+
+### Windows, Linux, and OS X for x86 and x64
+
+1. Install *CMake 3.2* or higher (*3.14* for Visual Studio 2019, or *3.10* on OS X with *Xcode 10*), *Python 2.7 or 3*, and the proper compiler for your platform.
+2. Execute `git submodule update --init` to get the files of external submodules (e.g. Catch2).
+3. Generate the IDE solution with: `python make.py`
+ The solution is generated under `./build`
+4. Build the IDE solution with: `python make.py -build`
+5. Run the unit tests with: `python make.py -unit_test`
+
+### Windows ARM64
-1. Install CMake 3.2 or higher, Python 3, and the proper compiler for your platform
-2. Generate the IDE solution with: `python make.py`
- The solution is generated under `./build`
- Note that if you do not have CMake in your `PATH`, you should define the `SJSON_CPP_CMAKE_HOME` environment variable to something like `C:\Program Files\CMake`.
-3. Build the IDE solution with: `python make.py -build`
-4. Run the unit tests with: `python make.py -unit_test`
+For *Windows on ARM64*, the steps are identical to *x86 and x64* but you will need *CMake 3.13 or higher* and you must provide the architecture on the command line: `python make.py -compiler vs2017 -cpu arm64`
### Android
-For Android, the steps are identical to Windows, Linux, and OS X but you also need to install NVIDIA CodeWorks 1R5 (or higher).
+For *Android*, the steps are identical to *Windows, Linux, and OS X* but you also need to install *Android NDK 21* (or higher). The build uses `gradle` and `-unit_test` will deploy and run on the device when executed (make sure that the `adb` executable is in your `PATH` for this to work).
+
+*Android Studio v3.5* can be used to launch and debug. After running *CMake* to build and generate everything, the *Android Studio* projects can be found under the `./build` directory.
### iOS
-For iOS, the steps are identical to the other platforms but due to code signing, you will need to perform the builds from Xcode manually. Note that this is only an issue if you attempt to use the tools or run the unit tests locally.
+For *iOS*, the steps are identical to the other platforms but due to code signing, you will need to perform the builds from *Xcode* manually. Note that this is only an issue if you attempt to use the tools or run the unit tests locally.
+
+### Emscripten
+
+Emscripten support currently only has been tested on OS X and Linux. To use it, make sure to install a recent version of Emscripten SDK 1.39.11+.
+
+## Commit message format
+
+This library uses the [angular.js message format](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) and it is enforced with commit linting through every pull request.
## Authors
@@ -78,3 +97,26 @@ This project uses the [MIT license](LICENSE).
Copyright (c) 2017 Nicholas Frechette, Cody Jones, and sjson-cpp contributors
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
+
+## Contributors ✨
+
+Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
+
+
+
+
+
+
+
+
+
+
+
+This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index 37f17b7..0000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-version: 0.5.0.{build}
-
-environment:
- PYTHON: "C:\\Python33-x64"
-
-image:
-- Visual Studio 2015
-- Visual Studio 2017
-
-build_script:
-- cmd: >-
- IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" (SET COMPILER=vs2015) ELSE (SET COMPILER=vs2017)
-
- %PYTHON%\\python.exe make.py -clean -build -unit_test -%COMPILER% -Debug -x86
-
- %PYTHON%\\python.exe make.py -clean -build -unit_test -%COMPILER% -Release -x86
-
- %PYTHON%\\python.exe make.py -clean -build -unit_test -%COMPILER% -Debug -x64
-
- %PYTHON%\\python.exe make.py -clean -build -unit_test -%COMPILER% -Release -x64
diff --git a/cmake/CMakeCompiler.cmake b/cmake/CMakeCompiler.cmake
index 8ee4186..07aec88 100644
--- a/cmake/CMakeCompiler.cmake
+++ b/cmake/CMakeCompiler.cmake
@@ -1,19 +1,41 @@
-cmake_minimum_required (VERSION 3.2)
-
macro(setup_default_compiler_flags _project_name)
if(MSVC)
# Replace some default compiler switches and add new ones
STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI
- STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Bump warnings to W4
+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable level 4 warnings
+ else()
+ if(MSVC_VERSION GREATER 1920)
+ # VS2019 and above
+ STRING(REPLACE "/W3" "/Wall" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable all warnings
+ else()
+ STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable level 4 warnings
+ endif()
+ endif()
target_compile_options(${_project_name} PRIVATE /Zi) # Add debug info
target_compile_options(${_project_name} PRIVATE /Oi) # Generate intrinsic functions
target_compile_options(${_project_name} PRIVATE /WX) # Treat warnings as errors
+ target_compile_options(${_project_name} PRIVATE /MP) # Enable parallel compilation
if(MSVC_VERSION GREATER 1900)
# VS2017 and above
target_compile_options(${_project_name} PRIVATE /permissive-)
endif()
+ # Disable various warnings that are harmless
+ target_compile_options(${_project_name} PRIVATE /wd4514) # Unreferenced inline function removed
+ target_compile_options(${_project_name} PRIVATE /wd4619) # No warning with specified number
+ target_compile_options(${_project_name} PRIVATE /wd4820) # Padding added after data member
+ target_compile_options(${_project_name} PRIVATE /wd4710) # Function not inlined
+ target_compile_options(${_project_name} PRIVATE /wd4711) # Function selected for automatic inlining
+ target_compile_options(${_project_name} PRIVATE /wd4738) # Storing 32-bit float in memory leads to rounding (x86)
+ target_compile_options(${_project_name} PRIVATE /wd5045) # Spectre mitigation for memory load
+
+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat) # No need to support C++98
+ target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat-pedantic) # No need to support C++98
+ endif()
+
# Add linker flags
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG")
else()
@@ -27,6 +49,14 @@ macro(setup_default_compiler_flags _project_name)
endif()
target_compile_options(${_project_name} PRIVATE -Wall -Wextra) # Enable all warnings
+ target_compile_options(${_project_name} PRIVATE -Wshadow) # Enable shadowing warnings
target_compile_options(${_project_name} PRIVATE -Werror) # Treat warnings as errors
+
+ # Disable various warnings that are harmless
+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat) # No need to support C++98
+ endif()
+
+ target_compile_options(${_project_name} PRIVATE -g) # Enable debug symbols
endif()
endmacro()
diff --git a/cmake/CMakePlatforms.cmake b/cmake/CMakePlatforms.cmake
index bb8d696..8d5b8f2 100644
--- a/cmake/CMakePlatforms.cmake
+++ b/cmake/CMakePlatforms.cmake
@@ -1,22 +1,27 @@
-cmake_minimum_required(VERSION 3.2)
+if(PLATFORM_NAME)
+ return() # Already set
+endif()
# Detect which platform we have
-if( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" )
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(PLATFORM_WINDOWS 1)
set(PLATFORM_NAME "Windows")
-elseif( ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" )
+elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if(PLATFORM_IOS)
set(PLATFORM_NAME "iOS")
else()
set(PLATFORM_OSX 1)
set(PLATFORM_NAME "OS X")
endif()
-elseif( ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" )
+elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(PLATFORM_LINUX 1)
set(PLATFORM_NAME "Linux")
-elseif( ${CMAKE_SYSTEM_NAME} STREQUAL "Android" )
+elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(PLATFORM_ANDROID 1)
set(PLATFORM_NAME "Android")
+elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
+ set(PLATFORM_EMSCRIPTEN 1)
+ set(PLATFORM_NAME "Emscripten")
else()
message(FATAL_ERROR "Unknown platform ${CMAKE_SYSTEM_NAME}!")
endif()
diff --git a/cmake/CMakeUtils.cmake b/cmake/CMakeUtils.cmake
index c18543f..52e4673 100644
--- a/cmake/CMakeUtils.cmake
+++ b/cmake/CMakeUtils.cmake
@@ -1,5 +1,3 @@
-cmake_minimum_required (VERSION 3.2)
-
# Create groups for the test source files, this creates the proper directory structure under the
# Visual Studio filters
macro(create_source_groups _source_files _relative_directory)
diff --git a/cmake/Toolchain-Android.cmake b/cmake/Toolchain-Android.cmake
index 97bda18..c91a8ea 100644
--- a/cmake/Toolchain-Android.cmake
+++ b/cmake/Toolchain-Android.cmake
@@ -1,6 +1,12 @@
-cmake_minimum_required (VERSION 3.2)
+# For Android, we just set the platform name as we won't be using CMake to build anything.
+# Instead Gradle is used through CMake.
-set(CMAKE_SYSTEM_NAME Android)
+set(PLATFORM_ANDROID 1)
+set(PLATFORM_NAME "Android")
-# Use the clang tool set because it's support for C++11 is superior
-set(CMAKE_GENERATOR_TOOLSET DefaultClang)
+# Remap our CPU instruction set
+if(CPU_INSTRUCTION_SET MATCHES "armv7")
+ set(CPU_INSTRUCTION_SET "armeabi-v7a")
+elseif(CPU_INSTRUCTION_SET MATCHES "arm64")
+ set(CPU_INSTRUCTION_SET "arm64-v8a")
+endif()
diff --git a/cmake/Toolchain-iOS.cmake b/cmake/Toolchain-iOS.cmake
index 0124d44..2d710d5 100644
--- a/cmake/Toolchain-iOS.cmake
+++ b/cmake/Toolchain-iOS.cmake
@@ -1,5 +1,3 @@
-cmake_minimum_required (VERSION 3.2)
-
set(CMAKE_SYSTEM_NAME Darwin)
# Set here instead of CMakePlatforms.cmake since we can't distinguis otherwise
@@ -10,7 +8,8 @@ execute_process(COMMAND xcrun --sdk iphoneos --find clang OUTPUT_VARIABLE CMAKE_
execute_process(COMMAND xcrun --sdk iphoneos --find clang++ OUTPUT_VARIABLE CMAKE_CXX_COMPILER OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_MACOSX_BUNDLE YES)
-set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED NO)
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
+set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS "")
set(CMAKE_OSX_SYSROOT iphoneos CACHE STRING "")
set(CMAKE_OSX_ARCHITECTURES arm64 CACHE STRING "")
-set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 11.0)
+set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 17.0)
diff --git a/external/README.md b/external/README.md
index 013c756..e71e8c2 100644
--- a/external/README.md
+++ b/external/README.md
@@ -4,4 +4,4 @@ Good news! There are no external dependencies needed by this library at runtime!
## Catch
-[Catch 1.9.6](https://github.com/catchorg/Catch2/releases/tag/v1.9.6) is used by our [unit tests](../tests). You will only need it if you run the unit tests and it is included as-is without modifications.
+[Catch2 v2.13.7](https://github.com/catchorg/Catch2/releases/tag/v2.13.7) is used by our [unit tests](../tests). You will only need it if you run the unit tests and it is included as-is without modifications.
diff --git a/external/catch-1.9.6/catch.hpp b/external/catch-1.9.6/catch.hpp
deleted file mode 100644
index f7681f4..0000000
--- a/external/catch-1.9.6/catch.hpp
+++ /dev/null
@@ -1,11545 +0,0 @@
-/*
- * Catch v1.9.6
- * Generated: 2017-06-27 12:19:54.557875
- * ----------------------------------------------------------
- * This file has been merged from multiple headers. Please don't edit it directly
- * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
-#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
-
-#define TWOBLUECUBES_CATCH_HPP_INCLUDED
-
-#ifdef __clang__
-# pragma clang system_header
-#elif defined __GNUC__
-# pragma GCC system_header
-#endif
-
-// #included from: internal/catch_suppress_warnings.h
-
-#ifdef __clang__
-# ifdef __ICC // icpc defines the __clang__ macro
-# pragma warning(push)
-# pragma warning(disable: 161 1682)
-# else // __ICC
-# pragma clang diagnostic ignored "-Wglobal-constructors"
-# pragma clang diagnostic ignored "-Wvariadic-macros"
-# pragma clang diagnostic ignored "-Wc99-extensions"
-# pragma clang diagnostic ignored "-Wunused-variable"
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wpadded"
-# pragma clang diagnostic ignored "-Wc++98-compat"
-# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
-# pragma clang diagnostic ignored "-Wswitch-enum"
-# pragma clang diagnostic ignored "-Wcovered-switch-default"
-# endif
-#elif defined __GNUC__
-# pragma GCC diagnostic ignored "-Wvariadic-macros"
-# pragma GCC diagnostic ignored "-Wunused-variable"
-# pragma GCC diagnostic ignored "-Wparentheses"
-
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wpadded"
-#endif
-#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
-# define CATCH_IMPL
-#endif
-
-#ifdef CATCH_IMPL
-# ifndef CLARA_CONFIG_MAIN
-# define CLARA_CONFIG_MAIN_NOT_DEFINED
-# define CLARA_CONFIG_MAIN
-# endif
-#endif
-
-// #included from: internal/catch_notimplemented_exception.h
-#define TWOBLUECUBES_CATCH_NOTIMPLEMENTED_EXCEPTION_H_INCLUDED
-
-// #included from: catch_common.h
-#define TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
-
-// #included from: catch_compiler_capabilities.h
-#define TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
-
-// Detect a number of compiler features - mostly C++11/14 conformance - by compiler
-// The following features are defined:
-//
-// CATCH_CONFIG_CPP11_NULLPTR : is nullptr supported?
-// CATCH_CONFIG_CPP11_NOEXCEPT : is noexcept supported?
-// CATCH_CONFIG_CPP11_GENERATED_METHODS : The delete and default keywords for compiler generated methods
-// CATCH_CONFIG_CPP11_IS_ENUM : std::is_enum is supported?
-// CATCH_CONFIG_CPP11_TUPLE : std::tuple is supported
-// CATCH_CONFIG_CPP11_LONG_LONG : is long long supported?
-// CATCH_CONFIG_CPP11_OVERRIDE : is override supported?
-// CATCH_CONFIG_CPP11_UNIQUE_PTR : is unique_ptr supported (otherwise use auto_ptr)
-// CATCH_CONFIG_CPP11_SHUFFLE : is std::shuffle supported?
-// CATCH_CONFIG_CPP11_TYPE_TRAITS : are type_traits and enable_if supported?
-
-// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
-
-// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
-// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
-// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
-// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
-// ****************
-// Note to maintainers: if new toggles are added please document them
-// in configuration.md, too
-// ****************
-
-// In general each macro has a _NO_ form
-// (e.g. CATCH_CONFIG_CPP11_NO_NULLPTR) which disables the feature.
-// Many features, at point of detection, define an _INTERNAL_ macro, so they
-// can be combined, en-mass, with the _NO_ forms later.
-
-// All the C++11 features can be disabled with CATCH_CONFIG_NO_CPP11
-
-#ifdef __cplusplus
-
-# if __cplusplus >= 201103L
-# define CATCH_CPP11_OR_GREATER
-# endif
-
-# if __cplusplus >= 201402L
-# define CATCH_CPP14_OR_GREATER
-# endif
-
-#endif
-
-#ifdef __clang__
-
-# if __has_feature(cxx_nullptr)
-# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
-# endif
-
-# if __has_feature(cxx_noexcept)
-# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
-# endif
-
-# if defined(CATCH_CPP11_OR_GREATER)
-# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- _Pragma( "clang diagnostic push" ) \
- _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" )
-# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
- _Pragma( "clang diagnostic pop" )
-
-# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
- _Pragma( "clang diagnostic push" ) \
- _Pragma( "clang diagnostic ignored \"-Wparentheses\"" )
-# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
- _Pragma( "clang diagnostic pop" )
-# endif
-
-#endif // __clang__
-
-////////////////////////////////////////////////////////////////////////////////
-// We know some environments not to support full POSIX signals
-#if defined(__CYGWIN__) || defined(__QNX__)
-
-# if !defined(CATCH_CONFIG_POSIX_SIGNALS)
-# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS
-# endif
-
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-// Cygwin
-#ifdef __CYGWIN__
-
-// Required for some versions of Cygwin to declare gettimeofday
-// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin
-# define _BSD_SOURCE
-
-#endif // __CYGWIN__
-
-////////////////////////////////////////////////////////////////////////////////
-// Borland
-#ifdef __BORLANDC__
-
-#endif // __BORLANDC__
-
-////////////////////////////////////////////////////////////////////////////////
-// EDG
-#ifdef __EDG_VERSION__
-
-#endif // __EDG_VERSION__
-
-////////////////////////////////////////////////////////////////////////////////
-// Digital Mars
-#ifdef __DMC__
-
-#endif // __DMC__
-
-////////////////////////////////////////////////////////////////////////////////
-// GCC
-#ifdef __GNUC__
-
-# if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
-# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
-# endif
-
-// - otherwise more recent versions define __cplusplus >= 201103L
-// and will get picked up below
-
-#endif // __GNUC__
-
-////////////////////////////////////////////////////////////////////////////////
-// Visual C++
-#ifdef _MSC_VER
-
-#define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
-
-#if (_MSC_VER >= 1600)
-# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
-# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
-#endif
-
-#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
-#define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
-#define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
-#define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
-#define CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS
-#endif
-
-#endif // _MSC_VER
-
-////////////////////////////////////////////////////////////////////////////////
-
-// Use variadic macros if the compiler supports them
-#if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \
- ( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \
- ( defined __GNUC__ && __GNUC__ >= 3 ) || \
- ( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
-
-#define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
-
-#endif
-
-// Use __COUNTER__ if the compiler supports it
-#if ( defined _MSC_VER && _MSC_VER >= 1300 ) || \
- ( defined __GNUC__ && ( __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3 )) ) || \
- ( defined __clang__ && __clang_major__ >= 3 )
-
-#define CATCH_INTERNAL_CONFIG_COUNTER
-
-#endif
-
-////////////////////////////////////////////////////////////////////////////////
-// C++ language feature support
-
-// catch all support for C++11
-#if defined(CATCH_CPP11_OR_GREATER)
-
-# if !defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR)
-# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
-# endif
-
-# ifndef CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
-# define CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT
-# endif
-
-# ifndef CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
-# define CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS
-# endif
-
-# ifndef CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
-# define CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM
-# endif
-
-# ifndef CATCH_INTERNAL_CONFIG_CPP11_TUPLE
-# define CATCH_INTERNAL_CONFIG_CPP11_TUPLE
-# endif
-
-# ifndef CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
-# define CATCH_INTERNAL_CONFIG_VARIADIC_MACROS
-# endif
-
-# if !defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG)
-# define CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG
-# endif
-
-# if !defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE)
-# define CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE
-# endif
-# if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR)
-# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
-# endif
-# if !defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE)
-# define CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE
-# endif
-# if !defined(CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS)
-# define CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS
-# endif
-
-#endif // __cplusplus >= 201103L
-
-// Now set the actual defines based on the above + anything the user has configured
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NO_NULLPTR) && !defined(CATCH_CONFIG_CPP11_NULLPTR) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_NULLPTR
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NO_NOEXCEPT) && !defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_NOEXCEPT
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_NO_GENERATED_METHODS) && !defined(CATCH_CONFIG_CPP11_GENERATED_METHODS) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_GENERATED_METHODS
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_NO_IS_ENUM) && !defined(CATCH_CONFIG_CPP11_IS_ENUM) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_IS_ENUM
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_CPP11_NO_TUPLE) && !defined(CATCH_CONFIG_CPP11_TUPLE) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_TUPLE
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS)
-# define CATCH_CONFIG_VARIADIC_MACROS
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_LONG_LONG
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_OVERRIDE
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_UNIQUE_PTR
-#endif
-// Use of __COUNTER__ is suppressed if __JETBRAINS_IDE__ is #defined (meaning we're being parsed by a JetBrains IDE for
-// analytics) because, at time of writing, __COUNTER__ is not properly handled by it.
-// This does not affect compilation
-#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) && !defined(__JETBRAINS_IDE__)
-# define CATCH_CONFIG_COUNTER
-#endif
-#if defined(CATCH_INTERNAL_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_NO_SHUFFLE) && !defined(CATCH_CONFIG_CPP11_SHUFFLE) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_SHUFFLE
-#endif
-# if defined(CATCH_INTERNAL_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_NO_TYPE_TRAITS) && !defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) && !defined(CATCH_CONFIG_NO_CPP11)
-# define CATCH_CONFIG_CPP11_TYPE_TRAITS
-# endif
-#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH)
-# define CATCH_CONFIG_WINDOWS_SEH
-#endif
-// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.
-#if !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)
-# define CATCH_CONFIG_POSIX_SIGNALS
-#endif
-
-#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)
-# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS
-# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS
-#endif
-#if !defined(CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS)
-# define CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS
-# define CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
-#endif
-
-// noexcept support:
-#if defined(CATCH_CONFIG_CPP11_NOEXCEPT) && !defined(CATCH_NOEXCEPT)
-# define CATCH_NOEXCEPT noexcept
-# define CATCH_NOEXCEPT_IS(x) noexcept(x)
-#else
-# define CATCH_NOEXCEPT throw()
-# define CATCH_NOEXCEPT_IS(x)
-#endif
-
-// nullptr support
-#ifdef CATCH_CONFIG_CPP11_NULLPTR
-# define CATCH_NULL nullptr
-#else
-# define CATCH_NULL NULL
-#endif
-
-// override support
-#ifdef CATCH_CONFIG_CPP11_OVERRIDE
-# define CATCH_OVERRIDE override
-#else
-# define CATCH_OVERRIDE
-#endif
-
-// unique_ptr support
-#ifdef CATCH_CONFIG_CPP11_UNIQUE_PTR
-# define CATCH_AUTO_PTR( T ) std::unique_ptr
-#else
-# define CATCH_AUTO_PTR( T ) std::auto_ptr
-#endif
-
-#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line
-#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )
-#ifdef CATCH_CONFIG_COUNTER
-# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
-#else
-# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
-#endif
-
-#define INTERNAL_CATCH_STRINGIFY2( expr ) #expr
-#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
-
-#include
-#include
-
-namespace Catch {
-
- struct IConfig;
-
- struct CaseSensitive { enum Choice {
- Yes,
- No
- }; };
-
- class NonCopyable {
-#ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
- NonCopyable( NonCopyable const& ) = delete;
- NonCopyable( NonCopyable && ) = delete;
- NonCopyable& operator = ( NonCopyable const& ) = delete;
- NonCopyable& operator = ( NonCopyable && ) = delete;
-#else
- NonCopyable( NonCopyable const& info );
- NonCopyable& operator = ( NonCopyable const& );
-#endif
-
- protected:
- NonCopyable() {}
- virtual ~NonCopyable();
- };
-
- class SafeBool {
- public:
- typedef void (SafeBool::*type)() const;
-
- static type makeSafe( bool value ) {
- return value ? &SafeBool::trueValue : 0;
- }
- private:
- void trueValue() const {}
- };
-
- template
- inline void deleteAll( ContainerT& container ) {
- typename ContainerT::const_iterator it = container.begin();
- typename ContainerT::const_iterator itEnd = container.end();
- for(; it != itEnd; ++it )
- delete *it;
- }
- template
- inline void deleteAllValues( AssociativeContainerT& container ) {
- typename AssociativeContainerT::const_iterator it = container.begin();
- typename AssociativeContainerT::const_iterator itEnd = container.end();
- for(; it != itEnd; ++it )
- delete it->second;
- }
-
- bool startsWith( std::string const& s, std::string const& prefix );
- bool startsWith( std::string const& s, char prefix );
- bool endsWith( std::string const& s, std::string const& suffix );
- bool endsWith( std::string const& s, char suffix );
- bool contains( std::string const& s, std::string const& infix );
- void toLowerInPlace( std::string& s );
- std::string toLower( std::string const& s );
- std::string trim( std::string const& str );
- bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
-
- struct pluralise {
- pluralise( std::size_t count, std::string const& label );
-
- friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );
-
- std::size_t m_count;
- std::string m_label;
- };
-
- struct SourceLineInfo {
-
- SourceLineInfo();
- SourceLineInfo( char const* _file, std::size_t _line );
-# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
- SourceLineInfo(SourceLineInfo const& other) = default;
- SourceLineInfo( SourceLineInfo && ) = default;
- SourceLineInfo& operator = ( SourceLineInfo const& ) = default;
- SourceLineInfo& operator = ( SourceLineInfo && ) = default;
-# endif
- bool empty() const;
- bool operator == ( SourceLineInfo const& other ) const;
- bool operator < ( SourceLineInfo const& other ) const;
-
- char const* file;
- std::size_t line;
- };
-
- std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
-
- // This is just here to avoid compiler warnings with macro constants and boolean literals
- inline bool isTrue( bool value ){ return value; }
- inline bool alwaysTrue() { return true; }
- inline bool alwaysFalse() { return false; }
-
- void throwLogicError( std::string const& message, SourceLineInfo const& locationInfo );
-
- void seedRng( IConfig const& config );
- unsigned int rngSeed();
-
- // Use this in variadic streaming macros to allow
- // >> +StreamEndStop
- // as well as
- // >> stuff +StreamEndStop
- struct StreamEndStop {
- std::string operator+() {
- return std::string();
- }
- };
- template
- T const& operator + ( T const& value, StreamEndStop ) {
- return value;
- }
-}
-
-#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) )
-#define CATCH_INTERNAL_ERROR( msg ) ::Catch::throwLogicError( msg, CATCH_INTERNAL_LINEINFO );
-
-namespace Catch {
-
- class NotImplementedException : public std::exception
- {
- public:
- NotImplementedException( SourceLineInfo const& lineInfo );
- NotImplementedException( NotImplementedException const& ) {}
-
- virtual ~NotImplementedException() CATCH_NOEXCEPT {}
-
- virtual const char* what() const CATCH_NOEXCEPT;
-
- private:
- std::string m_what;
- SourceLineInfo m_lineInfo;
- };
-
-} // end namespace Catch
-
-///////////////////////////////////////////////////////////////////////////////
-#define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO )
-
-// #included from: internal/catch_context.h
-#define TWOBLUECUBES_CATCH_CONTEXT_H_INCLUDED
-
-// #included from: catch_interfaces_generators.h
-#define TWOBLUECUBES_CATCH_INTERFACES_GENERATORS_H_INCLUDED
-
-#include
-
-namespace Catch {
-
- struct IGeneratorInfo {
- virtual ~IGeneratorInfo();
- virtual bool moveNext() = 0;
- virtual std::size_t getCurrentIndex() const = 0;
- };
-
- struct IGeneratorsForTest {
- virtual ~IGeneratorsForTest();
-
- virtual IGeneratorInfo& getGeneratorInfo( std::string const& fileInfo, std::size_t size ) = 0;
- virtual bool moveNext() = 0;
- };
-
- IGeneratorsForTest* createGeneratorsForTest();
-
-} // end namespace Catch
-
-// #included from: catch_ptr.hpp
-#define TWOBLUECUBES_CATCH_PTR_HPP_INCLUDED
-
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wpadded"
-#endif
-
-namespace Catch {
-
- // An intrusive reference counting smart pointer.
- // T must implement addRef() and release() methods
- // typically implementing the IShared interface
- template
- class Ptr {
- public:
- Ptr() : m_p( CATCH_NULL ){}
- Ptr( T* p ) : m_p( p ){
- if( m_p )
- m_p->addRef();
- }
- Ptr( Ptr const& other ) : m_p( other.m_p ){
- if( m_p )
- m_p->addRef();
- }
- ~Ptr(){
- if( m_p )
- m_p->release();
- }
- void reset() {
- if( m_p )
- m_p->release();
- m_p = CATCH_NULL;
- }
- Ptr& operator = ( T* p ){
- Ptr temp( p );
- swap( temp );
- return *this;
- }
- Ptr& operator = ( Ptr const& other ){
- Ptr temp( other );
- swap( temp );
- return *this;
- }
- void swap( Ptr& other ) { std::swap( m_p, other.m_p ); }
- T* get() const{ return m_p; }
- T& operator*() const { return *m_p; }
- T* operator->() const { return m_p; }
- bool operator !() const { return m_p == CATCH_NULL; }
- operator SafeBool::type() const { return SafeBool::makeSafe( m_p != CATCH_NULL ); }
-
- private:
- T* m_p;
- };
-
- struct IShared : NonCopyable {
- virtual ~IShared();
- virtual void addRef() const = 0;
- virtual void release() const = 0;
- };
-
- template
- struct SharedImpl : T {
-
- SharedImpl() : m_rc( 0 ){}
-
- virtual void addRef() const {
- ++m_rc;
- }
- virtual void release() const {
- if( --m_rc == 0 )
- delete this;
- }
-
- mutable unsigned int m_rc;
- };
-
-} // end namespace Catch
-
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
-
-namespace Catch {
-
- class TestCase;
- class Stream;
- struct IResultCapture;
- struct IRunner;
- struct IGeneratorsForTest;
- struct IConfig;
-
- struct IContext
- {
- virtual ~IContext();
-
- virtual IResultCapture* getResultCapture() = 0;
- virtual IRunner* getRunner() = 0;
- virtual size_t getGeneratorIndex( std::string const& fileInfo, size_t totalSize ) = 0;
- virtual bool advanceGeneratorsForCurrentTest() = 0;
- virtual Ptr getConfig() const = 0;
- };
-
- struct IMutableContext : IContext
- {
- virtual ~IMutableContext();
- virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
- virtual void setRunner( IRunner* runner ) = 0;
- virtual void setConfig( Ptr const& config ) = 0;
- };
-
- IContext& getCurrentContext();
- IMutableContext& getCurrentMutableContext();
- void cleanUpContext();
- Stream createStream( std::string const& streamName );
-
-}
-
-// #included from: internal/catch_test_registry.hpp
-#define TWOBLUECUBES_CATCH_TEST_REGISTRY_HPP_INCLUDED
-
-// #included from: catch_interfaces_testcase.h
-#define TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
-
-#include
-
-namespace Catch {
-
- class TestSpec;
-
- struct ITestCase : IShared {
- virtual void invoke () const = 0;
- protected:
- virtual ~ITestCase();
- };
-
- class TestCase;
- struct IConfig;
-
- struct ITestCaseRegistry {
- virtual ~ITestCaseRegistry();
- virtual std::vector const& getAllTests() const = 0;
- virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0;
- };
-
- bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
- std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config );
- std::vector const& getAllTestCasesSorted( IConfig const& config );
-
-}
-
-namespace Catch {
-
-template
-class MethodTestCase : public SharedImpl {
-
-public:
- MethodTestCase( void (C::*method)() ) : m_method( method ) {}
-
- virtual void invoke() const {
- C obj;
- (obj.*m_method)();
- }
-
-private:
- virtual ~MethodTestCase() {}
-
- void (C::*m_method)();
-};
-
-typedef void(*TestFunction)();
-
-struct NameAndDesc {
- NameAndDesc( const char* _name = "", const char* _description= "" )
- : name( _name ), description( _description )
- {}
-
- const char* name;
- const char* description;
-};
-
-void registerTestCase
- ( ITestCase* testCase,
- char const* className,
- NameAndDesc const& nameAndDesc,
- SourceLineInfo const& lineInfo );
-
-struct AutoReg {
-
- AutoReg
- ( TestFunction function,
- SourceLineInfo const& lineInfo,
- NameAndDesc const& nameAndDesc );
-
- template
- AutoReg
- ( void (C::*method)(),
- char const* className,
- NameAndDesc const& nameAndDesc,
- SourceLineInfo const& lineInfo ) {
-
- registerTestCase
- ( new MethodTestCase( method ),
- className,
- nameAndDesc,
- lineInfo );
- }
-
- ~AutoReg();
-
-private:
- AutoReg( AutoReg const& );
- void operator= ( AutoReg const& );
-};
-
-void registerTestCaseFunction
- ( TestFunction function,
- SourceLineInfo const& lineInfo,
- NameAndDesc const& nameAndDesc );
-
-} // end namespace Catch
-
-#ifdef CATCH_CONFIG_VARIADIC_MACROS
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \
- static void TestName(); \
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); } \
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
- static void TestName()
- #define INTERNAL_CATCH_TESTCASE( ... ) \
- INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ )
-
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); } \
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
-
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- namespace{ \
- struct TestName : ClassName{ \
- void test(); \
- }; \
- Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestName::test, #ClassName, Catch::NameAndDesc( __VA_ARGS__ ), CATCH_INTERNAL_LINEINFO ); \
- } \
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
- void TestName::test()
- #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \
- INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ )
-
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( __VA_ARGS__ ) ); \
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
-
-#else
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_TESTCASE2( TestName, Name, Desc ) \
- static void TestName(); \
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &TestName, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); }\
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
- static void TestName()
- #define INTERNAL_CATCH_TESTCASE( Name, Desc ) \
- INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), Name, Desc )
-
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, Name, Desc ) \
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &QualifiedMethod, "&" #QualifiedMethod, Catch::NameAndDesc( Name, Desc ), CATCH_INTERNAL_LINEINFO ); } \
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
-
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestCaseName, ClassName, TestName, Desc )\
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- namespace{ \
- struct TestCaseName : ClassName{ \
- void test(); \
- }; \
- Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( &TestCaseName::test, #ClassName, Catch::NameAndDesc( TestName, Desc ), CATCH_INTERNAL_LINEINFO ); \
- } \
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS \
- void TestCaseName::test()
- #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, TestName, Desc )\
- INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, TestName, Desc )
-
- ///////////////////////////////////////////////////////////////////////////////
- #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, Name, Desc ) \
- CATCH_INTERNAL_SUPPRESS_ETD_WARNINGS \
- Catch::AutoReg( Function, CATCH_INTERNAL_LINEINFO, Catch::NameAndDesc( Name, Desc ) ); \
- CATCH_INTERNAL_UNSUPPRESS_ETD_WARNINGS
-
-#endif
-
-// #included from: internal/catch_capture.hpp
-#define TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
-
-// #included from: catch_result_builder.h
-#define TWOBLUECUBES_CATCH_RESULT_BUILDER_H_INCLUDED
-
-// #included from: catch_result_type.h
-#define TWOBLUECUBES_CATCH_RESULT_TYPE_H_INCLUDED
-
-namespace Catch {
-
- // ResultWas::OfType enum
- struct ResultWas { enum OfType {
- Unknown = -1,
- Ok = 0,
- Info = 1,
- Warning = 2,
-
- FailureBit = 0x10,
-
- ExpressionFailed = FailureBit | 1,
- ExplicitFailure = FailureBit | 2,
-
- Exception = 0x100 | FailureBit,
-
- ThrewException = Exception | 1,
- DidntThrowException = Exception | 2,
-
- FatalErrorCondition = 0x200 | FailureBit
-
- }; };
-
- inline bool isOk( ResultWas::OfType resultType ) {
- return ( resultType & ResultWas::FailureBit ) == 0;
- }
- inline bool isJustInfo( int flags ) {
- return flags == ResultWas::Info;
- }
-
- // ResultDisposition::Flags enum
- struct ResultDisposition { enum Flags {
- Normal = 0x01,
-
- ContinueOnFailure = 0x02, // Failures fail test, but execution continues
- FalseTest = 0x04, // Prefix expression with !
- SuppressFail = 0x08 // Failures are reported but do not fail the test
- }; };
-
- inline ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) {
- return static_cast( static_cast( lhs ) | static_cast( rhs ) );
- }
-
- inline bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; }
- inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; }
- inline bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; }
-
-} // end namespace Catch
-
-// #included from: catch_assertionresult.h
-#define TWOBLUECUBES_CATCH_ASSERTIONRESULT_H_INCLUDED
-
-#include
-
-namespace Catch {
-
- struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison;
-
- struct DecomposedExpression
- {
- virtual ~DecomposedExpression() {}
- virtual bool isBinaryExpression() const {
- return false;
- }
- virtual void reconstructExpression( std::string& dest ) const = 0;
-
- // Only simple binary comparisons can be decomposed.
- // If more complex check is required then wrap sub-expressions in parentheses.
- template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator + ( T const& );
- template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( T const& );
- template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator * ( T const& );
- template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator / ( T const& );
- template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator % ( T const& );
- template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( T const& );
- template STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( T const& );
-
- private:
- DecomposedExpression& operator = (DecomposedExpression const&);
- };
-
- struct AssertionInfo
- {
- AssertionInfo() {}
- AssertionInfo( char const * _macroName,
- SourceLineInfo const& _lineInfo,
- char const * _capturedExpression,
- ResultDisposition::Flags _resultDisposition,
- char const * _secondArg = "");
-
- char const * macroName;
- SourceLineInfo lineInfo;
- char const * capturedExpression;
- ResultDisposition::Flags resultDisposition;
- char const * secondArg;
- };
-
- struct AssertionResultData
- {
- AssertionResultData() : decomposedExpression( CATCH_NULL )
- , resultType( ResultWas::Unknown )
- , negated( false )
- , parenthesized( false ) {}
-
- void negate( bool parenthesize ) {
- negated = !negated;
- parenthesized = parenthesize;
- if( resultType == ResultWas::Ok )
- resultType = ResultWas::ExpressionFailed;
- else if( resultType == ResultWas::ExpressionFailed )
- resultType = ResultWas::Ok;
- }
-
- std::string const& reconstructExpression() const {
- if( decomposedExpression != CATCH_NULL ) {
- decomposedExpression->reconstructExpression( reconstructedExpression );
- if( parenthesized ) {
- reconstructedExpression.insert( 0, 1, '(' );
- reconstructedExpression.append( 1, ')' );
- }
- if( negated ) {
- reconstructedExpression.insert( 0, 1, '!' );
- }
- decomposedExpression = CATCH_NULL;
- }
- return reconstructedExpression;
- }
-
- mutable DecomposedExpression const* decomposedExpression;
- mutable std::string reconstructedExpression;
- std::string message;
- ResultWas::OfType resultType;
- bool negated;
- bool parenthesized;
- };
-
- class AssertionResult {
- public:
- AssertionResult();
- AssertionResult( AssertionInfo const& info, AssertionResultData const& data );
- ~AssertionResult();
-# ifdef CATCH_CONFIG_CPP11_GENERATED_METHODS
- AssertionResult( AssertionResult const& ) = default;
- AssertionResult( AssertionResult && ) = default;
- AssertionResult& operator = ( AssertionResult const& ) = default;
- AssertionResult& operator = ( AssertionResult && ) = default;
-# endif
-
- bool isOk() const;
- bool succeeded() const;
- ResultWas::OfType getResultType() const;
- bool hasExpression() const;
- bool hasMessage() const;
- std::string getExpression() const;
- std::string getExpressionInMacro() const;
- bool hasExpandedExpression() const;
- std::string getExpandedExpression() const;
- std::string getMessage() const;
- SourceLineInfo getSourceInfo() const;
- std::string getTestMacroName() const;
- void discardDecomposedExpression() const;
- void expandDecomposedExpression() const;
-
- protected:
- AssertionInfo m_info;
- AssertionResultData m_resultData;
- };
-
-} // end namespace Catch
-
-// #included from: catch_matchers.hpp
-#define TWOBLUECUBES_CATCH_MATCHERS_HPP_INCLUDED
-
-namespace Catch {
-namespace Matchers {
- namespace Impl {
-
- template struct MatchAllOf;
- template struct MatchAnyOf;
- template struct MatchNotOf;
-
- class MatcherUntypedBase {
- public:
- std::string toString() const {
- if( m_cachedToString.empty() )
- m_cachedToString = describe();
- return m_cachedToString;
- }
-
- protected:
- virtual ~MatcherUntypedBase();
- virtual std::string describe() const = 0;
- mutable std::string m_cachedToString;
- private:
- MatcherUntypedBase& operator = ( MatcherUntypedBase const& );
- };
-
- template
- struct MatcherMethod {
- virtual bool match( ObjectT const& arg ) const = 0;
- };
- template
- struct MatcherMethod {
- virtual bool match( PtrT* arg ) const = 0;
- };
-
- template
- struct MatcherBase : MatcherUntypedBase, MatcherMethod {
-
- MatchAllOf operator && ( MatcherBase const& other ) const;
- MatchAnyOf operator || ( MatcherBase const& other ) const;
- MatchNotOf operator ! () const;
- };
-
- template
- struct MatchAllOf : MatcherBase {
- virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE {
- for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
- if (!m_matchers[i]->match(arg))
- return false;
- }
- return true;
- }
- virtual std::string describe() const CATCH_OVERRIDE {
- std::string description;
- description.reserve( 4 + m_matchers.size()*32 );
- description += "( ";
- for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
- if( i != 0 )
- description += " and ";
- description += m_matchers[i]->toString();
- }
- description += " )";
- return description;
- }
-
- MatchAllOf& operator && ( MatcherBase const& other ) {
- m_matchers.push_back( &other );
- return *this;
- }
-
- std::vector const*> m_matchers;
- };
- template
- struct MatchAnyOf : MatcherBase {
-
- virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE {
- for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
- if (m_matchers[i]->match(arg))
- return true;
- }
- return false;
- }
- virtual std::string describe() const CATCH_OVERRIDE {
- std::string description;
- description.reserve( 4 + m_matchers.size()*32 );
- description += "( ";
- for( std::size_t i = 0; i < m_matchers.size(); ++i ) {
- if( i != 0 )
- description += " or ";
- description += m_matchers[i]->toString();
- }
- description += " )";
- return description;
- }
-
- MatchAnyOf& operator || ( MatcherBase const& other ) {
- m_matchers.push_back( &other );
- return *this;
- }
-
- std::vector const*> m_matchers;
- };
-
- template
- struct MatchNotOf : MatcherBase {
-
- MatchNotOf( MatcherBase const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {}
-
- virtual bool match( ArgT const& arg ) const CATCH_OVERRIDE {
- return !m_underlyingMatcher.match( arg );
- }
-
- virtual std::string describe() const CATCH_OVERRIDE {
- return "not " + m_underlyingMatcher.toString();
- }
- MatcherBase const& m_underlyingMatcher;
- };
-
- template
- MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const {
- return MatchAllOf() && *this && other;
- }
- template
- MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const {
- return MatchAnyOf() || *this || other;
- }
- template
- MatchNotOf MatcherBase::operator ! () const {
- return MatchNotOf( *this );
- }
-
- } // namespace Impl
-
- // The following functions create the actual matcher objects.
- // This allows the types to be inferred
- // - deprecated: prefer ||, && and !
- template
- inline Impl::MatchNotOf Not( Impl::MatcherBase const& underlyingMatcher ) {
- return Impl::MatchNotOf( underlyingMatcher );
- }
- template
- inline Impl::MatchAllOf AllOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2 ) {
- return Impl::MatchAllOf() && m1 && m2;
- }
- template
- inline Impl::MatchAllOf AllOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2, Impl::MatcherBase const& m3 ) {
- return Impl::MatchAllOf() && m1 && m2 && m3;
- }
- template
- inline Impl::MatchAnyOf AnyOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2 ) {
- return Impl::MatchAnyOf() || m1 || m2;
- }
- template
- inline Impl::MatchAnyOf AnyOf( Impl::MatcherBase const& m1, Impl::MatcherBase const& m2, Impl::MatcherBase const& m3 ) {
- return Impl::MatchAnyOf() || m1 || m2 || m3;
- }
-
-} // namespace Matchers
-
-using namespace Matchers;
-using Matchers::Impl::MatcherBase;
-
-} // namespace Catch
-
-namespace Catch {
-
- struct TestFailureException{};
-
- template class ExpressionLhs;
-
- struct CopyableStream {
- CopyableStream() {}
- CopyableStream( CopyableStream const& other ) {
- oss << other.oss.str();
- }
- CopyableStream& operator=( CopyableStream const& other ) {
- oss.str(std::string());
- oss << other.oss.str();
- return *this;
- }
- std::ostringstream oss;
- };
-
- class ResultBuilder : public DecomposedExpression {
- public:
- ResultBuilder( char const* macroName,
- SourceLineInfo const& lineInfo,
- char const* capturedExpression,
- ResultDisposition::Flags resultDisposition,
- char const* secondArg = "" );
- ~ResultBuilder();
-
- template
- ExpressionLhs operator <= ( T const& operand );
- ExpressionLhs operator <= ( bool value );
-
- template
- ResultBuilder& operator << ( T const& value ) {
- m_stream().oss << value;
- return *this;
- }
-
- ResultBuilder& setResultType( ResultWas::OfType result );
- ResultBuilder& setResultType( bool result );
-
- void endExpression( DecomposedExpression const& expr );
-
- virtual void reconstructExpression( std::string& dest ) const CATCH_OVERRIDE;
-
- AssertionResult build() const;
- AssertionResult build( DecomposedExpression const& expr ) const;
-
- void useActiveException( ResultDisposition::Flags resultDisposition = ResultDisposition::Normal );
- void captureResult( ResultWas::OfType resultType );
- void captureExpression();
- void captureExpectedException( std::string const& expectedMessage );
- void captureExpectedException( Matchers::Impl::MatcherBase const& matcher );
- void handleResult( AssertionResult const& result );
- void react();
- bool shouldDebugBreak() const;
- bool allowThrows() const;
-
- template
- void captureMatch( ArgT const& arg, MatcherT const& matcher, char const* matcherString );
-
- void setExceptionGuard();
- void unsetExceptionGuard();
-
- private:
- AssertionInfo m_assertionInfo;
- AssertionResultData m_data;
-
- static CopyableStream &m_stream()
- {
- static CopyableStream s;
- return s;
- }
-
- bool m_shouldDebugBreak;
- bool m_shouldThrow;
- bool m_guardException;
- };
-
-} // namespace Catch
-
-// Include after due to circular dependency:
-// #included from: catch_expression_lhs.hpp
-#define TWOBLUECUBES_CATCH_EXPRESSION_LHS_HPP_INCLUDED
-
-// #included from: catch_evaluate.hpp
-#define TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED
-
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
-#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)
-#endif
-
-#include
-
-namespace Catch {
-namespace Internal {
-
- enum Operator {
- IsEqualTo,
- IsNotEqualTo,
- IsLessThan,
- IsGreaterThan,
- IsLessThanOrEqualTo,
- IsGreaterThanOrEqualTo
- };
-
- template struct OperatorTraits { static const char* getName(){ return "*error*"; } };
- template<> struct OperatorTraits { static const char* getName(){ return "=="; } };
- template<> struct OperatorTraits { static const char* getName(){ return "!="; } };
- template<> struct OperatorTraits { static const char* getName(){ return "<"; } };
- template<> struct OperatorTraits { static const char* getName(){ return ">"; } };
- template<> struct OperatorTraits { static const char* getName(){ return "<="; } };
- template<> struct OperatorTraits{ static const char* getName(){ return ">="; } };
-
- template
- inline T& opCast(T const& t) { return const_cast(t); }
-
-// nullptr_t support based on pull request #154 from Konstantin Baumann
-#ifdef CATCH_CONFIG_CPP11_NULLPTR
- inline std::nullptr_t opCast(std::nullptr_t) { return nullptr; }
-#endif // CATCH_CONFIG_CPP11_NULLPTR
-
- // So the compare overloads can be operator agnostic we convey the operator as a template
- // enum, which is used to specialise an Evaluator for doing the comparison.
- template
- class Evaluator{};
-
- template
- struct Evaluator {
- static bool evaluate( T1 const& lhs, T2 const& rhs) {
- return bool( opCast( lhs ) == opCast( rhs ) );
- }
- };
- template
- struct Evaluator {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) != opCast( rhs ) );
- }
- };
- template
- struct Evaluator {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) < opCast( rhs ) );
- }
- };
- template
- struct Evaluator {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) > opCast( rhs ) );
- }
- };
- template
- struct Evaluator {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) >= opCast( rhs ) );
- }
- };
- template
- struct Evaluator {
- static bool evaluate( T1 const& lhs, T2 const& rhs ) {
- return bool( opCast( lhs ) <= opCast( rhs ) );
- }
- };
-
- template
- bool applyEvaluator( T1 const& lhs, T2 const& rhs ) {
- return Evaluator::evaluate( lhs, rhs );
- }
-
- // This level of indirection allows us to specialise for integer types
- // to avoid signed/ unsigned warnings
-
- // "base" overload
- template
- bool compare( T1 const& lhs, T2 const& rhs ) {
- return Evaluator::evaluate( lhs, rhs );
- }
-
- // unsigned X to int
- template bool compare( unsigned int lhs, int rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned long lhs, int rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned char lhs, int rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
-
- // unsigned X to long
- template bool compare( unsigned int lhs, long rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned long lhs, long rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
- template bool compare( unsigned char lhs, long rhs ) {
- return applyEvaluator( lhs, static_cast( rhs ) );
- }
-
- // int to unsigned X
- template bool compare( int lhs, unsigned int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( int lhs, unsigned long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( int lhs, unsigned char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // long to unsigned X
- template bool compare( long lhs, unsigned int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long lhs, unsigned long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long lhs, unsigned char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // pointer to long (when comparing against NULL)
- template bool compare( long lhs, T* rhs ) {
- return Evaluator::evaluate( reinterpret_cast( lhs ), rhs );
- }
- template bool compare( T* lhs, long rhs ) {
- return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) );
- }
-
- // pointer to int (when comparing against NULL)
- template bool compare( int lhs, T* rhs ) {
- return Evaluator::evaluate( reinterpret_cast( lhs ), rhs );
- }
- template bool compare( T* lhs, int rhs ) {
- return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) );
- }
-
-#ifdef CATCH_CONFIG_CPP11_LONG_LONG
- // long long to unsigned X
- template bool compare( long long lhs, unsigned int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long long lhs, unsigned long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long long lhs, unsigned long long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( long long lhs, unsigned char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // unsigned long long to X
- template bool compare( unsigned long long lhs, int rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( unsigned long long lhs, long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( unsigned long long lhs, long long rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
- template bool compare( unsigned long long lhs, char rhs ) {
- return applyEvaluator( static_cast( lhs ), rhs );
- }
-
- // pointer to long long (when comparing against NULL)
- template bool compare( long long lhs, T* rhs ) {
- return Evaluator::evaluate( reinterpret_cast( lhs ), rhs );
- }
- template bool compare( T* lhs, long long rhs ) {
- return Evaluator::evaluate( lhs, reinterpret_cast( rhs ) );
- }
-#endif // CATCH_CONFIG_CPP11_LONG_LONG
-
-#ifdef CATCH_CONFIG_CPP11_NULLPTR
- // pointer to nullptr_t (when comparing against nullptr)
- template bool compare( std::nullptr_t, T* rhs ) {
- return Evaluator::evaluate( nullptr, rhs );
- }
- template bool compare( T* lhs, std::nullptr_t ) {
- return Evaluator::evaluate( lhs, nullptr );
- }
-#endif // CATCH_CONFIG_CPP11_NULLPTR
-
-} // end of namespace Internal
-} // end of namespace Catch
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-// #included from: catch_tostring.h
-#define TWOBLUECUBES_CATCH_TOSTRING_H_INCLUDED
-
-#include
-#include
-#include
-#include
-#include
-
-#ifdef __OBJC__
-// #included from: catch_objc_arc.hpp
-#define TWOBLUECUBES_CATCH_OBJC_ARC_HPP_INCLUDED
-
-#import
-
-#ifdef __has_feature
-#define CATCH_ARC_ENABLED __has_feature(objc_arc)
-#else
-#define CATCH_ARC_ENABLED 0
-#endif
-
-void arcSafeRelease( NSObject* obj );
-id performOptionalSelector( id obj, SEL sel );
-
-#if !CATCH_ARC_ENABLED
-inline void arcSafeRelease( NSObject* obj ) {
- [obj release];
-}
-inline id performOptionalSelector( id obj, SEL sel ) {
- if( [obj respondsToSelector: sel] )
- return [obj performSelector: sel];
- return nil;
-}
-#define CATCH_UNSAFE_UNRETAINED
-#define CATCH_ARC_STRONG
-#else
-inline void arcSafeRelease( NSObject* ){}
-inline id performOptionalSelector( id obj, SEL sel ) {
-#ifdef __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
-#endif
- if( [obj respondsToSelector: sel] )
- return [obj performSelector: sel];
-#ifdef __clang__
-#pragma clang diagnostic pop
-#endif
- return nil;
-}
-#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained
-#define CATCH_ARC_STRONG __strong
-#endif
-
-#endif
-
-#ifdef CATCH_CONFIG_CPP11_TUPLE
-#include
-#endif
-
-#ifdef CATCH_CONFIG_CPP11_IS_ENUM
-#include
-#endif
-
-namespace Catch {
-
-// Why we're here.
-template
-std::string toString( T const& value );
-
-// Built in overloads
-
-std::string toString( std::string const& value );
-std::string toString( std::wstring const& value );
-std::string toString( const char* const value );
-std::string toString( char* const value );
-std::string toString( const wchar_t* const value );
-std::string toString( wchar_t* const value );
-std::string toString( int value );
-std::string toString( unsigned long value );
-std::string toString( unsigned int value );
-std::string toString( const double value );
-std::string toString( const float value );
-std::string toString( bool value );
-std::string toString( char value );
-std::string toString( signed char value );
-std::string toString( unsigned char value );
-
-#ifdef CATCH_CONFIG_CPP11_LONG_LONG
-std::string toString( long long value );
-std::string toString( unsigned long long value );
-#endif
-
-#ifdef CATCH_CONFIG_CPP11_NULLPTR
-std::string toString( std::nullptr_t );
-#endif
-
-#ifdef __OBJC__
- std::string toString( NSString const * const& nsstring );
- std::string toString( NSString * CATCH_ARC_STRONG & nsstring );
- std::string toString( NSObject* const& nsObject );
-#endif
-
-namespace Detail {
-
- extern const std::string unprintableString;
-
- #if !defined(CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK)
- struct BorgType {
- template BorgType( T const& );
- };
-
- struct TrueType { char sizer[1]; };
- struct FalseType { char sizer[2]; };
-
- TrueType& testStreamable( std::ostream& );
- FalseType testStreamable( FalseType );
-
- FalseType operator<<( std::ostream const&, BorgType const& );
-
- template
- struct IsStreamInsertable {
- static std::ostream &s;
- static T const&t;
- enum { value = sizeof( testStreamable(s << t) ) == sizeof( TrueType ) };
- };
-#else
- template
- class IsStreamInsertable {
- template
- static auto test(int)
- -> decltype( std::declval() << std::declval(), std::true_type() );
-
- template
- static auto test(...) -> std::false_type;
-
- public:
- static const bool value = decltype(test(0))::value;
- };
-#endif
-
-#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
- template::value
- >
- struct EnumStringMaker
- {
- static std::string convert( T const& ) { return unprintableString; }
- };
-
- template
- struct EnumStringMaker
- {
- static std::string convert( T const& v )
- {
- return ::Catch::toString(
- static_cast::type>(v)
- );
- }
- };
-#endif
- template
- struct StringMakerBase {
-#if defined(CATCH_CONFIG_CPP11_IS_ENUM)
- template
- static std::string convert( T const& v )
- {
- return EnumStringMaker::convert( v );
- }
-#else
- template
- static std::string convert( T const& ) { return unprintableString; }
-#endif
- };
-
- template<>
- struct StringMakerBase {
- template
- static std::string convert( T const& _value ) {
- std::ostringstream oss;
- oss << _value;
- return oss.str();
- }
- };
-
- std::string rawMemoryToString( const void *object, std::size_t size );
-
- template
- inline std::string rawMemoryToString( const T& object ) {
- return rawMemoryToString( &object, sizeof(object) );
- }
-
-} // end namespace Detail
-
-template
-struct StringMaker :
- Detail::StringMakerBase::value> {};
-
-template
-struct StringMaker {
- template
- static std::string convert( U* p ) {
- if( !p )
- return "NULL";
- else
- return Detail::rawMemoryToString( p );
- }
-};
-
-template
-struct StringMaker {
- static std::string convert( R C::* p ) {
- if( !p )
- return "NULL";
- else
- return Detail::rawMemoryToString( p );
- }
-};
-
-namespace Detail {
- template
- std::string rangeToString( InputIterator first, InputIterator last );
-}
-
-//template
-//struct StringMaker > {
-// static std::string convert( std::vector const& v ) {
-// return Detail::rangeToString( v.begin(), v.end() );
-// }
-//};
-
-template