Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
畅游知识海洋
json
提交
73727c98
J
json
项目概览
畅游知识海洋
/
json
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
json
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
73727c98
编写于
10月 05, 2017
作者:
N
Niels Lohmann
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'feature/coveralls' into develop
上级
99ee4c1e
75f4678b
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
831 addition
and
43 deletion
+831
-43
.gitignore
.gitignore
+1
-15
.travis.yml
.travis.yml
+6
-16
Makefile
Makefile
+15
-0
test/CMakeLists.txt
test/CMakeLists.txt
+26
-5
test/src/prefix.hpp
test/src/prefix.hpp
+0
-7
test/thirdparty/imapdl/filterbr.py
test/thirdparty/imapdl/filterbr.py
+109
-0
test/thirdparty/imapdl/gpl-3.0.txt
test/thirdparty/imapdl/gpl-3.0.txt
+674
-0
未找到文件。
.gitignore
浏览文件 @
73727c98
...
@@ -7,9 +7,8 @@ fuzz-testing
...
@@ -7,9 +7,8 @@ fuzz-testing
*.gcno
*.gcno
*.gcda
*.gcda
ndk
build
build
working
build_coverage
doc/xml
doc/xml
doc/html
doc/html
...
@@ -20,17 +19,4 @@ benchmarks/files/numbers/*.json
...
@@ -20,17 +19,4 @@ benchmarks/files/numbers/*.json
.idea
.idea
cmake-build-debug
cmake-build-debug
test/test-*
test/test-*
.svn
test/thirdparty/Fuzzer/libFuzzer.a
test/parse_afl_fuzzer
test/parse_cbor_fuzzer
test/parse_msgpack_fuzzer
minibench
.travis.yml
浏览文件 @
73727c98
...
@@ -81,24 +81,14 @@ matrix:
...
@@ -81,24 +81,14 @@ matrix:
addons
:
addons
:
apt
:
apt
:
sources
:
[
'
ubuntu-toolchain-r-test'
]
sources
:
[
'
ubuntu-toolchain-r-test'
]
packages
:
[
'
g++-4.9'
,
'
ruby'
,
'
ninja-build'
]
packages
:
[
'
g++-4.9'
,
'
ninja-build'
]
before_script
:
before_script
:
-
wget http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz
-
tar xf lcov_1.11.orig.tar.gz
-
sudo make -C lcov-1.11/ install
-
gem install coveralls-lcov
-
pip install --user cpp-coveralls
-
pip install --user cpp-coveralls
after_success
:
after_success
:
-
make clean
-
coveralls --build-root test --include src --gcov 'gcov-4.9' --gcov-options '\-lp'
-
CXXFLAGS="--coverage -g -O0" CPPFLAGS="-DNDEBUG" make json_unit
-
test/json_unit "*"
-
coveralls --build-root test --exclude src/catch.hpp --exclude src/unit-algorithms.cpp --exclude src/unit-allocator.cpp --exclude src/unit-capacity.cpp --exclude src/unit-class_const_iterator.cpp --exclude src/unit-class_iterator.cpp --exclude src/unit-class_lexer.cpp --exclude src/unit-class_parser.cpp --exclude src/unit-comparison.cpp --exclude src/unit-concepts.cpp --exclude src/unit-constructor1.cpp --exclude src/unit-constructor2.cpp --exclude src/unit-convenience.cpp --exclude src/unit-conversions.cpp --exclude src/unit-deserialization.cpp --exclude src/unit-element_access1.cpp --exclude src/unit-element_access2.cpp --exclude src/unit-inspection.cpp --exclude src/unit-iterator_wrapper.cpp --exclude src/unit-iterators1.cpp --exclude src/unit-iterators2.cpp --exclude src/unit-json_patch.cpp --exclude src/unit-json_pointer.cpp --exclude src/unit-modifiers.cpp --exclude src/unit-pointer_access.cpp --exclude src/unit-readme.cpp --exclude src/unit-reference_access.cpp --exclude src/unit-regression.cpp --exclude src/unit-serialization.cpp --exclude src/unit-testsuites.cpp --exclude src/unit-unicode.cpp --include ../src/json.hpp --gcov-options '\-lp' --gcov 'gcov-4.9'
-
lcov --directory src --directory test/src --capture --output-file coverage.info --rc lcov_branch_coverage=1 --no-external
-
lcov --remove coverage.info 'test/src/*' --output-file coverage.info --rc lcov_branch_coverage=1
-
lcov --list coverage.info --rc lcov_branch_coverage=1
-
coveralls-lcov --repo-token F9bs4Nop10JRgqPQXRcifyQKYhb3FczkS coverage.info
env
:
env
:
-
COMPILER=g++-4.9
-
COMPILER=g++-4.9
-
CMAKE_OPTIONS=-DJSON_Coverage=ON
-
SPECIAL=coveralls
-
SPECIAL=coveralls
# Coverity (only for branch coverity_scan)
# Coverity (only for branch coverity_scan)
...
@@ -115,8 +105,8 @@ matrix:
...
@@ -115,8 +105,8 @@ matrix:
name
:
"
nlohmann/json"
name
:
"
nlohmann/json"
description
:
"
Build
submitted
via
Travis
CI"
description
:
"
Build
submitted
via
Travis
CI"
notification_email
:
niels.lohmann@gmail.com
notification_email
:
niels.lohmann@gmail.com
build_command_prepend
:
"
m
ake
clean
"
build_command_prepend
:
"
m
kdir
coverity_build
;
cd
coverity_build
;
cmake
..
;
cd
..
"
build_command
:
"
make"
build_command
:
"
make
-C
coverity_build
"
branch_pattern
:
coverity_scan
branch_pattern
:
coverity_scan
env
:
env
:
-
SPECIAL=coverity
-
SPECIAL=coverity
...
@@ -262,7 +252,7 @@ matrix:
...
@@ -262,7 +252,7 @@ matrix:
################
################
script
:
script
:
# get CMake (only for systems with brew - macOS)
# get CMake
and Ninja
(only for systems with brew - macOS)
-
|
-
|
if [[ (-x $(which brew)) ]]; then
if [[ (-x $(which brew)) ]]; then
brew update
brew update
...
...
Makefile
浏览文件 @
73727c98
...
@@ -5,6 +5,7 @@ all:
...
@@ -5,6 +5,7 @@ all:
@
echo
"check - compile and execute test suite"
@
echo
"check - compile and execute test suite"
@
echo
"check-fast - compile and execute test suite (skip long-running tests)"
@
echo
"check-fast - compile and execute test suite (skip long-running tests)"
@
echo
"clean - remove built files"
@
echo
"clean - remove built files"
@
echo
"coverage - create coverage information with lcov"
@
echo
"cppcheck - analyze code with cppcheck"
@
echo
"cppcheck - analyze code with cppcheck"
@
echo
"doctest - compile example files and check their output"
@
echo
"doctest - compile example files and check their output"
@
echo
"fuzz_testing - prepare fuzz testing of the JSON parser"
@
echo
"fuzz_testing - prepare fuzz testing of the JSON parser"
...
@@ -35,11 +36,25 @@ check-fast:
...
@@ -35,11 +36,25 @@ check-fast:
clean
:
clean
:
rm
-fr
json_unit json_benchmarks fuzz fuzz-testing
*
.dSYM
test
/
*
.dSYM
rm
-fr
json_unit json_benchmarks fuzz fuzz-testing
*
.dSYM
test
/
*
.dSYM
rm
-fr
benchmarks/files/numbers/
*
.json
rm
-fr
benchmarks/files/numbers/
*
.json
rm
-fr
build_coverage
$(MAKE)
clean
-Cdoc
$(MAKE)
clean
-Cdoc
$(MAKE)
clean
-Ctest
$(MAKE)
clean
-Ctest
$(MAKE)
clean
-Cbenchmarks
$(MAKE)
clean
-Cbenchmarks
##########################################################################
# coverage
##########################################################################
coverage
:
mkdir
build_coverage
cd
build_coverage
;
CXX
=
g++-5 cmake ..
-GNinja
-DJSON_Coverage
=
ON
cd
build_coverage
;
ninja
cd
build_coverage
;
ctest
cd
build_coverage
;
ninja lcov_html
open build_coverage/test/html/index.html
##########################################################################
##########################################################################
# documentation tests
# documentation tests
##########################################################################
##########################################################################
...
...
test/CMakeLists.txt
浏览文件 @
73727c98
option
(
JSON_Sanitizer
"Build test suite with Clang sanitizer"
OFF
)
option
(
JSON_Sanitizer
"Build test suite with Clang sanitizer"
OFF
)
option
(
JSON_Valgrind
"Execute test suite with Valgrind"
OFF
)
option
(
JSON_Valgrind
"Execute test suite with Valgrind"
OFF
)
option
(
JSON_NoExceptions
"Build test suite without exceptions"
OFF
)
option
(
JSON_NoExceptions
"Build test suite without exceptions"
OFF
)
option
(
JSON_Coverage
"Build test suite with coverage information"
OFF
)
if
(
JSON_Sanitizer
)
if
(
JSON_Sanitizer
)
message
(
STATUS
"Building test suite with Clang sanitizer"
)
message
(
STATUS
"Building test suite with Clang sanitizer"
)
...
@@ -25,6 +26,31 @@ if(JSON_NoExceptions)
...
@@ -25,6 +26,31 @@ if(JSON_NoExceptions)
set
(
CATCH_TEST_FILTER -e
)
set
(
CATCH_TEST_FILTER -e
)
endif
()
endif
()
if
(
JSON_Coverage
)
message
(
STATUS
"Building test suite with coverage information"
)
if
(
NOT
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"GNU"
)
message
(
FATAL_ERROR
"JSON_Coverage requires GCC."
)
endif
()
# enable profiling
set
(
CMAKE_CXX_FLAGS
"--coverage -g -O0 -fprofile-arcs -ftest-coverage"
)
# from https://github.com/RWTH-HPC/CMake-codecov/blob/master/cmake/FindGcov.cmake
get_filename_component
(
COMPILER_PATH
"
${
CMAKE_CXX_COMPILER
}
"
PATH
)
string
(
REGEX MATCH
"^[0-9]+"
GCC_VERSION
"
${
CMAKE_CXX_COMPILER_VERSION
}
"
)
find_program
(
GCOV_BIN NAMES gcov-
${
GCC_VERSION
}
gcov HINTS
${
COMPILER_PATH
}
)
# add target to collect coverage information and generate HTML file
# (filter script from https://stackoverflow.com/a/43726240/266378)
add_custom_target
(
lcov_html
COMMAND lcov --directory . --capture --output-file json.info --gcov-tool
${
GCOV_BIN
}
--rc lcov_branch_coverage=1
COMMAND lcov -e json.info
${
CMAKE_SOURCE_DIR
}
/src/json.hpp --output-file json.info.filtered --rc lcov_branch_coverage=1
COMMAND
${
CMAKE_SOURCE_DIR
}
/test/thirdparty/imapdl/filterbr.py json.info.filtered > json.info.filtered.noexcept
COMMAND genhtml --title
"JSON for Modern C++"
--legend --demangle-cpp --output-directory html --show-details --branch-coverage json.info.filtered.noexcept
COMMENT
"Generating HTML report test/html/index.html"
)
endif
()
#############################################################################
#############################################################################
# Catch library with the main function to speed up build
# Catch library with the main function to speed up build
#############################################################################
#############################################################################
...
@@ -65,11 +91,6 @@ foreach(file ${files})
...
@@ -65,11 +91,6 @@ foreach(file ${files})
set_target_properties
(
${
testcase
}
PROPERTIES COMPILE_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wno-float-equal"
)
set_target_properties
(
${
testcase
}
PROPERTIES COMPILE_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-deprecated -Wno-float-equal"
)
endif
()
endif
()
include
(
cotire OPTIONAL
)
if
(
COMMAND cotire
)
cotire
(
${
testcase
}
)
endif
()
add_test
(
NAME
"
${
testcase
}
_default"
add_test
(
NAME
"
${
testcase
}
_default"
COMMAND
${
testcase
}
${
CATCH_TEST_FILTER
}
COMMAND
${
testcase
}
${
CATCH_TEST_FILTER
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
...
...
test/src/prefix.hpp
已删除
100644 → 0
浏览文件 @
99ee4c1e
#pragma once
#include "catch.hpp"
#define private public
#include "json.hpp"
using
nlohmann
::
json
;
test/thirdparty/imapdl/filterbr.py
0 → 100755
浏览文件 @
73727c98
#!/usr/bin/env python3
# 2017, Georg Sauthoff <mail@gms.tf>, GPLv3
import
sys
def
skip_comments
(
lines
):
state
=
0
for
line
in
lines
:
n
=
len
(
line
)
l
=
''
p
=
0
while
p
<
n
:
if
state
==
0
:
a
=
line
.
find
(
'//'
,
p
)
b
=
line
.
find
(
'/*'
,
p
)
if
a
>
-
1
and
(
a
<
b
or
b
==
-
1
):
l
+=
line
[
p
:
a
]
p
=
n
elif
b
>
-
1
and
(
b
<
a
or
a
==
-
1
):
l
+=
line
[
p
:
b
]
p
=
b
+
2
state
=
1
else
:
l
+=
line
[
p
:]
p
=
n
elif
state
==
1
:
a
=
line
.
rfind
(
'*/'
,
p
)
if
a
==
-
1
:
p
=
n
else
:
p
=
a
+
2
state
=
0
yield
l
def
cond_lines
(
lines
):
state
=
0
pcnt
=
0
for
nr
,
line
in
enumerate
(
lines
,
1
):
if
not
line
:
continue
n
=
len
(
line
)
p
=
0
do_yield
=
False
while
p
<
n
:
if
state
==
0
:
p
=
line
.
find
(
'if'
,
p
)
if
p
==
-
1
:
p
=
n
continue
if
(
p
==
0
or
not
line
[
p
-
1
].
isalpha
())
\
and
(
p
+
2
==
len
(
line
)
or
not
line
[
p
+
2
].
isalpha
()):
do_yield
=
True
state
=
1
p
+=
2
elif
state
==
1
:
do_yield
=
True
p
=
line
.
find
(
'('
,
p
)
if
p
==
-
1
:
p
=
n
else
:
p
+=
1
state
=
2
pcnt
=
1
elif
state
==
2
:
do_yield
=
True
for
p
in
range
(
p
,
n
):
if
line
[
p
]
==
'('
:
pcnt
+=
1
elif
line
[
p
]
==
')'
:
pcnt
-=
1
if
not
pcnt
:
state
=
0
break
p
+=
1
if
do_yield
:
yield
nr
def
cond_lines_from_file
(
filename
):
with
open
(
filename
)
as
f
:
yield
from
cond_lines
(
skip_comments
(
f
))
def
filter_lcov_trace
(
lines
):
nrs
=
set
()
for
line
in
lines
:
if
line
.
startswith
(
'SF:'
):
nrs
=
set
(
cond_lines_from_file
(
line
[
3
:
-
1
]))
elif
line
.
startswith
(
'BRDA:'
):
xs
=
line
[
5
:].
split
(
','
)
nr
=
int
(
xs
[
0
])
if
xs
else
0
if
nr
not
in
nrs
:
continue
yield
line
def
filter_lcov_trace_file
(
s_filename
,
d_file
):
with
open
(
s_filename
)
as
f
:
for
l
in
filter_lcov_trace
(
f
):
print
(
l
,
end
=
''
,
file
=
d_file
)
if
__name__
==
'__main__'
:
#for l in cond_lines_from_file(sys.argv[1]):
# print(l)
filter_lcov_trace_file
(
sys
.
argv
[
1
],
sys
.
stdout
)
#with open(sys.argv[1]) as f:
# for l in skip_comments(f):
# print(l)
test/thirdparty/imapdl/gpl-3.0.txt
0 → 100644
浏览文件 @
73727c98
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录