├── .gitignore ├── Build ├── Dependencies │ └── deploy_dependencies.py └── Installer │ ├── Installer-Template.iss │ ├── create_installer.py │ └── modpath.iss ├── CMakeLists.txt ├── CoverageTool ├── CMakeLists.txt ├── CoverageTool.cpp └── CoverageTool.vcxproj ├── CppCoverage.sln ├── CppCoverage ├── Address.cpp ├── Address.hpp ├── BreakPoint.cpp ├── BreakPoint.hpp ├── CodeCoverageRunner.cpp ├── CodeCoverageRunner.hpp ├── CoverageDataMerger.cpp ├── CoverageDataMerger.hpp ├── CoverageFilterManager.cpp ├── CoverageFilterManager.hpp ├── CoverageFilterSettings.cpp ├── CoverageFilterSettings.hpp ├── CppCoverage.vcxproj ├── CppCoverageExport.hpp ├── DebugInformation.cpp ├── DebugInformation.hpp ├── Debugger.cpp ├── Debugger.hpp ├── ExceptionHandler.cpp ├── ExceptionHandler.hpp ├── ExecutedAddressManager.cpp ├── ExecutedAddressManager.hpp ├── FileDebugInformation.cpp ├── FileDebugInformation.hpp ├── HandleInformation.cpp ├── HandleInformation.hpp ├── ICoverageFilterManager.hpp ├── IDebugEventsHandler.cpp ├── IDebugEventsHandler.hpp ├── IDebugInformationEventHandler.cpp ├── IDebugInformationEventHandler.hpp ├── Options.cpp ├── Options.hpp ├── OptionsExport.cpp ├── OptionsExport.hpp ├── OptionsParser.cpp ├── OptionsParser.hpp ├── Patterns.cpp ├── Patterns.hpp ├── Process.cpp ├── Process.hpp ├── ProgramOptions.cpp ├── ProgramOptions.hpp ├── ReadMe.txt ├── RunCoverageSettings.cpp ├── RunCoverageSettings.hpp ├── StartInfo.cpp ├── StartInfo.hpp ├── UnifiedDiffCoverageFilterManager.cpp ├── UnifiedDiffCoverageFilterManager.hpp ├── UnifiedDiffSettings.cpp ├── UnifiedDiffSettings.hpp ├── WildcardCoverageFilter.cpp ├── WildcardCoverageFilter.hpp ├── Wildcards.cpp ├── Wildcards.hpp ├── stdafx.cpp └── stdafx.h ├── CppCoverageCross ├── CMakeLists.txt ├── CoverageData.cpp ├── CoverageData.hpp ├── CoverageRate.cpp ├── CoverageRate.hpp ├── CoverageRateComputer.cpp ├── CoverageRateComputer.hpp ├── CppCoverageCross.vcxproj ├── CppCoverageException.cpp ├── CppCoverageException.hpp ├── CppCoverageExport.hpp ├── FileCoverage.cpp ├── FileCoverage.hpp ├── LineCoverage.cpp ├── LineCoverage.hpp ├── ModuleCoverage.cpp └── ModuleCoverage.hpp ├── CppCoverageTest ├── CodeCoverageRunnerTest.cpp ├── CoverageDataMergerRandomTest.cpp ├── CoverageDataMergerTest.cpp ├── CoverageDataTest.cpp ├── CoverageFilterManagerMock.hpp ├── CoverageRateComputerTest.cpp ├── CoverageRateTest.cpp ├── CppCoverageExceptionTest.cpp ├── CppCoverageTest.cpp ├── CppCoverageTest.vcxproj ├── Data │ └── TestDiff.diff ├── DebugEventsMock.hpp ├── DebugInformationEventHandlerMock.hpp ├── DebugInformationTest.cpp ├── DebuggerTest.cpp ├── ExceptionHandlerTest.cpp ├── ExecutedAddressManagerTest.cpp ├── FileCoverageTest.cpp ├── HandleInformationTest.cpp ├── OptionsParserConfigTest.cpp ├── OptionsParserExportTest.cpp ├── OptionsParserPatternTest.cpp ├── OptionsParserTest.cpp ├── OptionsParserUnifiedDiffTest.cpp ├── ProcessTest.cpp ├── ReadMe.txt ├── StartInfoTest.cpp ├── TestTools.cpp ├── TestTools.hpp ├── UnifiedDiffCoverageFilterManagerTest.cpp ├── WildcardCoverageFilterTest.cpp ├── WildcardsTest.cpp ├── stdafx.cpp └── stdafx.h ├── CreateRelease.bat ├── Exporter ├── Binary │ ├── BinaryExporter.cpp │ ├── BinaryExporter.hpp │ ├── CoverageData.proto │ ├── CoverageDataDeserializer.cpp │ ├── CoverageDataDeserializer.hpp │ ├── CoverageDataSerializer.cpp │ ├── CoverageDataSerializer.hpp │ └── ProtoBuff.hpp ├── CMakeLists.txt ├── CoberturaExporter.cpp ├── CoberturaExporter.hpp ├── Exporter.vcxproj ├── ExporterException.cpp ├── ExporterException.hpp ├── ExporterExport.hpp ├── Html │ ├── CTemplate.hpp │ ├── HtmlExporter.cpp │ ├── HtmlExporter.hpp │ ├── HtmlFile.cpp │ ├── HtmlFile.hpp │ ├── HtmlFileCoverageExporter.cpp │ ├── HtmlFileCoverageExporter.hpp │ ├── HtmlFolderStructure.cpp │ ├── HtmlFolderStructure.hpp │ ├── Template │ │ ├── MainTemplate.html │ │ ├── SourceTemplate.html │ │ └── third-party │ │ │ ├── JQuery │ │ │ └── jquery-1.11.1.min.js │ │ │ ├── RGraph │ │ │ ├── libraries │ │ │ │ ├── RGraph.common.core.js │ │ │ │ ├── RGraph.common.dynamic.js │ │ │ │ ├── RGraph.common.tooltips.js │ │ │ │ └── RGraph.pie.js │ │ │ └── license.txt │ │ │ ├── css │ │ │ ├── style.css │ │ │ └── table-images │ │ │ │ ├── botleft.png │ │ │ │ ├── botright.png │ │ │ │ ├── left.png │ │ │ │ └── right.png │ │ │ └── google-code-prettify │ │ │ ├── prettify-CppCoverage.css │ │ │ ├── prettify.js │ │ │ └── run_prettify.js │ ├── TemplateHtmlExporter.cpp │ └── TemplateHtmlExporter.hpp ├── IExporter.hpp ├── stdafx.cpp └── stdafx.h ├── ExporterTest ├── BinaryExporterTest.cpp ├── CoberturaExporterTest.cpp ├── CoverageDataSerializerTest.cpp ├── Data │ ├── CoberturaExporterExpectedResult.xml │ ├── TestFile1.cpp │ └── TestFile2.cpp ├── ExporterTest.cpp ├── ExporterTest.vcxproj ├── HtmlExporterTest.cpp ├── HtmlFileCoverageExporterTest.cpp ├── HtmlFolderStructureTest.cpp ├── ReadMe.txt ├── TemplateHtmlExporterTest.cpp ├── stdafx.cpp └── stdafx.h ├── FileFilter ├── IRelocationsExtractor.hpp ├── LineFilter.cpp ├── LineFilter.hpp ├── LineInfo.hpp ├── ReleaseCoverageFilter.cpp ├── ReleaseCoverageFilter.hpp ├── RelocationsExtractor.cpp ├── RelocationsExtractor.hpp └── stdafx.h ├── FileFilterCross ├── AmbiguousPathException.cpp ├── AmbiguousPathException.hpp ├── CMakeLists.txt ├── File.cpp ├── File.hpp ├── FileFilter.vcxproj ├── FileFilterCross.vcxproj ├── FileFilterException.hpp ├── FileFilterExport.hpp ├── FileInfo.hpp ├── ModuleInfo.hpp ├── PathMatcher.cpp ├── PathMatcher.hpp ├── UnifiedDiffCoverageFilter.cpp ├── UnifiedDiffCoverageFilter.hpp ├── UnifiedDiffParser.cpp ├── UnifiedDiffParser.hpp ├── UnifiedDiffParserException.cpp ├── UnifiedDiffParserException.hpp ├── stdafx.cpp └── stdafx.h ├── FileFilterTest ├── Data │ ├── test.diff │ ├── test_add.diff │ ├── test_git.diff │ └── test_remove.diff ├── FileFilterTest.cpp ├── FileFilterTest.vcxproj ├── LineFilterTest.cpp ├── PathMatcherTest.cpp ├── RelocationsExtractorTest.cpp ├── Tools.cpp ├── Tools.hpp ├── UnifiedDiffCoverageFilterTest.cpp ├── UnifiedDiffParserTest.cpp ├── stdafx.cpp └── stdafx.h ├── IntegrationTests.testsettings ├── OpenCppCoverage ├── OpenCppCoverage.cpp ├── OpenCppCoverage.hpp ├── OpenCppCoverage.vcxproj ├── OpenCppCoverageException.hpp ├── OpenCppCoverageExport.hpp ├── ReadMe.txt ├── main.cpp ├── stdafx.cpp └── stdafx.h ├── OpenCppCoverageTest ├── CommandLineOptionsTest.cpp ├── ImportExportTests.cpp ├── OpenCppCoverageConsoleTest.cpp ├── OpenCppCoverageTest.cpp ├── OpenCppCoverageTest.vcxproj ├── OpenCppCoverageTestTools.cpp ├── OpenCppCoverageTestTools.hpp ├── stdafx.cpp └── stdafx.h ├── PropertySheets ├── Boost.64.props ├── Boost.props ├── CTemplate.Debug.props ├── CTemplate.Debug.x64.props ├── CTemplate.Release.props ├── CTemplate.Release.x64.props ├── Default.props ├── GMock.Debug.props ├── GMock.Debug.x64.props ├── GMock.Release.props ├── GMock.Release.x64.props ├── Poco.props ├── Poco.x64.props ├── ProtoBuff.Debug.props ├── ProtoBuff.Debug.x64.props ├── ProtoBuff.Release.props └── ProtoBuff.Release.x64.props ├── TestCoverageConsole ├── FileWithSpecialCharéàè.hpp ├── ReadMe.txt ├── SpecialLineInfo.cpp ├── SpecialLineInfo.hpp ├── TestBasic.cpp ├── TestBasic.hpp ├── TestCoverageConsole.cpp ├── TestCoverageConsole.hpp ├── TestCoverageConsole.vcxproj ├── TestDiff.cpp ├── TestDiff.hpp ├── TestThread.cpp └── TestThread.hpp ├── TestCoverageOptimizedBuild ├── TestCoverageOptimizedBuild.cpp ├── TestCoverageOptimizedBuild.hpp └── TestCoverageOptimizedBuild.vcxproj ├── TestCoverageSharedLib ├── ReadMe.txt ├── TestCoverageSharedLib.cpp ├── TestCoverageSharedLib.hpp ├── TestCoverageSharedLib.vcxproj ├── stdafx.cpp └── stdafx.h ├── TestHelper ├── AutoClose.hpp ├── Container.hpp ├── Container.inl ├── CoverageDataComparer.cpp ├── CoverageDataComparer.hpp ├── ReadMe.txt ├── TemporaryPath.cpp ├── TemporaryPath.hpp ├── TestHelper.vcxproj ├── TestHelperExport.hpp ├── Tools.cpp ├── Tools.hpp ├── stdafx.cpp └── stdafx.h ├── Tools ├── DbgHelp.hpp ├── MappedFile.cpp ├── MappedFile.hpp ├── ReadMe.txt ├── Tool.cpp ├── Tool.hpp ├── Tools.vcxproj ├── ToolsExport.hpp ├── dllmain.cpp ├── stdafx.cpp └── stdafx.h ├── ToolsCross ├── CMakeLists.txt ├── ExceptionBase.cpp ├── ExceptionBase.hpp ├── Log.cpp ├── Log.hpp ├── ScopedAction.cpp ├── ScopedAction.hpp ├── ToolsCross.vcxproj ├── ToolsException.hpp ├── ToolsExport.hpp ├── UniquePath.cpp └── UniquePath.hpp ├── ToolsLinux ├── CMakeLists.txt ├── Tool.cpp ├── Tool.hpp └── ToolsExport.hpp ├── ToolsTest ├── MappedFileTest.cpp ├── ReadMe.txt ├── ToolTest.cpp ├── ToolsTest.cpp ├── ToolsTest.vcxproj ├── stdafx.cpp └── stdafx.h └── UnitTests.testsettings /.gitignore: -------------------------------------------------------------------------------- 1 | */Debug 2 | */Release 3 | */x64 4 | Debug/ 5 | Release/ 6 | ipch/* 7 | *.sdf 8 | *.opensdf 9 | *.suo 10 | *.filters 11 | *.user 12 | *.ipch 13 | *.log 14 | *.opendb 15 | CoverageReport-* 16 | NewRelease 17 | TestResults/ 18 | packages/* 19 | Build/Installer/VCRedist/* 20 | Build/Dependencies/Dependencies-vs*.zip 21 | 22 | 23 | # Template file / unmanaged dll for the plugin 24 | VSPackage/OpenCppCoverage-x64 25 | VSPackage/OpenCppCoverage-x86 26 | 27 | # ProtoBuff files 28 | *.pb.* 29 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | project(CovTool) 3 | 4 | subdirs(CoverageTool CppCoverageCross Exporter FileFilterCross ToolsCross ToolsLinux) -------------------------------------------------------------------------------- /CoverageTool/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Minimum CMake required 2 | cmake_minimum_required(VERSION 2.8.12) 3 | 4 | set(CMAKE_CXX_STANDARD 14) 5 | set(CMAKE_CXX_FLAGS "-D__STRICT_ANSI__") 6 | 7 | set(Boost_USE_STATIC_LIBS ON) 8 | set(Boost_USE_MULTITHREADED ON) 9 | set(Boost_USE_STATIC_RUNTIME OFF) 10 | find_package(Boost COMPONENTS filesystem log) 11 | 12 | message(STATUS "making CoverageTool...") 13 | link_libraries( 14 | Exporter 15 | CppCoverageCross 16 | FileFilterCross 17 | ToolsCross 18 | ToolsLinux 19 | ctemplate 20 | pthread) 21 | link_directories( 22 | /home/nicklas/Downloads/ctemplate-ctemplate-2.3/ 23 | ${Boost_LIBRARY_DIRS}) 24 | 25 | if(Boost_FOUND) 26 | message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") 27 | message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}") 28 | message(STATUS "Boost_VERSION: ${Boost_VERSION}") 29 | include_directories(${PROJECT_SOURCE_DIR} ${Boost_INCLUDE_DIRS}) 30 | 31 | add_executable(CovTool CoverageTool.cpp) 32 | 33 | target_link_libraries(CovTool 34 | ${Boost_LIBRARIES} 35 | ) 36 | endif() 37 | -------------------------------------------------------------------------------- /CppCoverage/Address.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include "CppCoverageExport.hpp" 21 | 22 | namespace CppCoverage 23 | { 24 | class CPPCOVERAGE_DLL Address 25 | { 26 | public: 27 | Address(HANDLE hProcess, void* value); 28 | Address(const Address&) = default; 29 | 30 | HANDLE GetProcessHandle() const; 31 | void* GetValue() const; 32 | 33 | bool operator<(const Address& other) const; 34 | friend std::wostream& operator<<(std::wostream&, const Address&); 35 | 36 | private: 37 | Address& operator=(const Address&) = delete; 38 | 39 | private: 40 | HANDLE hProcess_; 41 | void* value_; 42 | }; 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /CppCoverage/BreakPoint.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | namespace CppCoverage 20 | { 21 | class Address; 22 | 23 | class BreakPoint 24 | { 25 | public: 26 | BreakPoint() = default; 27 | 28 | unsigned char SetBreakPointAt(const Address&) const; 29 | void RemoveBreakPoint(const Address&, unsigned char oldInstruction) const; 30 | 31 | void AdjustEipAfterBreakPointRemoval(HANDLE hThread) const; 32 | 33 | private: 34 | BreakPoint(const BreakPoint&) = delete; 35 | BreakPoint& operator=(const BreakPoint&) = delete; 36 | }; 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /CppCoverage/CoverageDataMerger.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverageExport.hpp" 20 | 21 | namespace CppCoverage 22 | { 23 | class CoverageData; 24 | 25 | class CPPCOVERAGE_DLL CoverageDataMerger 26 | { 27 | public: 28 | CoverageDataMerger() = default; 29 | 30 | CoverageData Merge(const std::vector&) const; 31 | void MergeFileCoverage(CoverageData&) const; 32 | 33 | private: 34 | CoverageDataMerger(const CoverageDataMerger&) = delete; 35 | CoverageDataMerger& operator=(const CoverageDataMerger&) = delete; 36 | }; 37 | } -------------------------------------------------------------------------------- /CppCoverage/CoverageFilterSettings.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include "CoverageFilterSettings.hpp" 19 | 20 | #include 21 | 22 | namespace CppCoverage 23 | { 24 | //------------------------------------------------------------------------- 25 | CoverageFilterSettings::CoverageFilterSettings( 26 | const Patterns& modulePatterns, 27 | const Patterns& sourcePatterns) 28 | : modulePatterns_(modulePatterns) 29 | , sourcePatterns_(sourcePatterns) 30 | { 31 | } 32 | 33 | //------------------------------------------------------------------------- 34 | const Patterns& CoverageFilterSettings::GetModulePatterns() const 35 | { 36 | return modulePatterns_; 37 | } 38 | 39 | //------------------------------------------------------------------------- 40 | const Patterns& CoverageFilterSettings::GetSourcePatterns() const 41 | { 42 | return sourcePatterns_; 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /CppCoverage/CoverageFilterSettings.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "CppCoverageExport.hpp" 23 | #include "Patterns.hpp" 24 | 25 | namespace CppCoverage 26 | { 27 | class CPPCOVERAGE_DLL CoverageFilterSettings 28 | { 29 | public: 30 | CoverageFilterSettings(const Patterns& modulePatterns, const Patterns& sourcePatterns); 31 | CoverageFilterSettings(const CoverageFilterSettings&) = default; 32 | CoverageFilterSettings& operator=(const CoverageFilterSettings&) = delete; 33 | 34 | const Patterns& GetModulePatterns() const; 35 | const Patterns& GetSourcePatterns() const; 36 | 37 | private: 38 | Patterns modulePatterns_; 39 | Patterns sourcePatterns_; 40 | }; 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /CppCoverage/CppCoverageExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#ifdef CPPCOVERAGE_EXPORTS 20 | // #define CPPCOVERAGE_DLL __declspec(dllexport) 21 | //#else 22 | // #define CPPCOVERAGE_DLL _declspec(dllimport) 23 | //#endif 24 | #define CPPCOVERAGE_DLL 25 | 26 | #pragma warning (disable: 4251) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /CppCoverage/DebugInformation.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverageExport.hpp" 20 | #include "FileDebugInformation.hpp" 21 | 22 | namespace CppCoverage 23 | { 24 | class IDebugInformationEventHandler; 25 | class ICoverageFilterManager; 26 | 27 | class CPPCOVERAGE_DLL DebugInformation 28 | { 29 | public: 30 | explicit DebugInformation(HANDLE hProcess); 31 | ~DebugInformation(); 32 | 33 | void LoadModule( 34 | const std::wstring& filename, 35 | HANDLE hFile, 36 | void* baseOfImage, 37 | ICoverageFilterManager&, 38 | IDebugInformationEventHandler& debugInformationEventHandler) const; 39 | 40 | private: 41 | DebugInformation(const DebugInformation&) = delete; 42 | DebugInformation& operator=(const DebugInformation&) = delete; 43 | 44 | void UpdateSearchPath(const std::wstring&) const; 45 | 46 | private: 47 | HANDLE hProcess_; 48 | std::string defaultSearchPath_; 49 | FileDebugInformation fileDebugInformation_; 50 | }; 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /CppCoverage/FileDebugInformation.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverageExport.hpp" 20 | #include 21 | 22 | namespace FileFilter 23 | { 24 | class ModuleInfo; 25 | } 26 | 27 | namespace CppCoverage 28 | { 29 | class IDebugInformationEventHandler; 30 | class ICoverageFilterManager; 31 | 32 | class CPPCOVERAGE_DLL FileDebugInformation 33 | { 34 | public: 35 | FileDebugInformation() = default; 36 | 37 | void LoadFile( 38 | const FileFilter::ModuleInfo&, 39 | const std::wstring& filename, 40 | ICoverageFilterManager& coverageFilterManager, 41 | IDebugInformationEventHandler& debugInformationEventHandler) const; 42 | 43 | private: 44 | FileDebugInformation(const FileDebugInformation&) = delete; 45 | FileDebugInformation& operator=(const FileDebugInformation&) = delete; 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /CppCoverage/HandleInformation.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "CppCoverageExport.hpp" 22 | 23 | namespace CppCoverage 24 | { 25 | class CPPCOVERAGE_DLL HandleInformation 26 | { 27 | public: 28 | HandleInformation(); 29 | std::wstring ComputeFilename(HANDLE hfile) const; 30 | 31 | private: 32 | HandleInformation(const HandleInformation&) = delete; 33 | HandleInformation& operator=(const HandleInformation&) = delete; 34 | }; 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /CppCoverage/ICoverageFilterManager.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverageExport.hpp" 20 | #include 21 | 22 | namespace FileFilter 23 | { 24 | class ModuleInfo; 25 | class FileInfo; 26 | class LineInfo; 27 | } 28 | 29 | namespace CppCoverage 30 | { 31 | class CoverageFilterSettings; 32 | 33 | class CPPCOVERAGE_DLL ICoverageFilterManager 34 | { 35 | public: 36 | virtual ~ICoverageFilterManager() = default; 37 | 38 | virtual bool IsModuleSelected(const std::wstring& filename) const = 0; 39 | virtual bool IsSourceFileSelected(const std::wstring& filename) = 0; 40 | virtual bool IsLineSelected( 41 | const FileFilter::ModuleInfo&, 42 | const FileFilter::FileInfo&, 43 | const FileFilter::LineInfo&) = 0; 44 | }; 45 | } 46 | 47 | 48 | -------------------------------------------------------------------------------- /CppCoverage/IDebugEventsHandler.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "CppCoverageExport.hpp" 22 | 23 | namespace CppCoverage 24 | { 25 | class CPPCOVERAGE_DLL IDebugEventsHandler 26 | { 27 | public: 28 | enum class ExceptionType 29 | { 30 | BreakPoint, 31 | InvalidBreakPoint, 32 | NotHandled, 33 | Error, 34 | CppError 35 | }; 36 | 37 | IDebugEventsHandler() = default; 38 | virtual ~IDebugEventsHandler() = default; 39 | 40 | virtual void OnCreateProcess(const CREATE_PROCESS_DEBUG_INFO&); 41 | virtual void OnExitProcess(HANDLE hProcess, HANDLE hThread, const EXIT_PROCESS_DEBUG_INFO&); 42 | virtual void OnLoadDll(HANDLE hProcess, HANDLE hThread, const LOAD_DLL_DEBUG_INFO&); 43 | virtual void OnUnloadDll(HANDLE hProcess, HANDLE hThread, const UNLOAD_DLL_DEBUG_INFO&); 44 | virtual ExceptionType OnException(HANDLE hProcess, HANDLE hThread, const EXCEPTION_DEBUG_INFO&); 45 | 46 | private: 47 | IDebugEventsHandler(const IDebugEventsHandler&) = delete; 48 | IDebugEventsHandler& operator=(const IDebugEventsHandler&) = delete; 49 | }; 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /CppCoverage/IDebugInformationEventHandler.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include "IDebugInformationEventHandler.hpp" 19 | 20 | namespace CppCoverage 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /CppCoverage/IDebugInformationEventHandler.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include "CppCoverageExport.hpp" 22 | 23 | namespace CppCoverage 24 | { 25 | class Address; 26 | 27 | class CPPCOVERAGE_DLL IDebugInformationEventHandler 28 | { 29 | public: 30 | IDebugInformationEventHandler() = default; 31 | virtual ~IDebugInformationEventHandler() = default; 32 | 33 | virtual void OnNewLine(const std::wstring& fileName, int lineNumber, const Address&) = 0; 34 | 35 | private: 36 | IDebugInformationEventHandler(const IDebugInformationEventHandler&) = delete; 37 | IDebugInformationEventHandler& operator=(const IDebugInformationEventHandler&) = delete; 38 | }; 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /CppCoverage/OptionsExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "CppCoverageExport.hpp" 23 | 24 | namespace CppCoverage 25 | { 26 | enum class OptionsExportType 27 | { 28 | Html, 29 | Cobertura, 30 | Binary 31 | }; 32 | 33 | class CPPCOVERAGE_DLL OptionsExport 34 | { 35 | public: 36 | explicit OptionsExport(OptionsExportType type); 37 | OptionsExport(OptionsExportType type, const boost::filesystem::path&); 38 | 39 | OptionsExport(const OptionsExport&) = default; 40 | OptionsExport& operator=(const OptionsExport&) = default; 41 | 42 | OptionsExportType GetType() const; 43 | const std::wstring& GetTypeString() const; 44 | const boost::optional& GetOutputPath() const; 45 | 46 | friend std::wostream& operator<<(std::wostream& ostr, const OptionsExport&); 47 | 48 | private: 49 | OptionsExportType type_; 50 | boost::optional outputPath_; 51 | }; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /CppCoverage/Patterns.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "CppCoverageExport.hpp" 23 | 24 | namespace CppCoverage 25 | { 26 | class CPPCOVERAGE_DLL Patterns 27 | { 28 | public: 29 | typedef std::vector T_Patterns; 30 | 31 | public: 32 | explicit Patterns(bool isRegexCaseSensitiv = false); 33 | Patterns(const Patterns&) = default; 34 | Patterns(Patterns&&); 35 | 36 | void AddSelectedPatterns(const std::wstring&); 37 | const T_Patterns& GetSelectedPatterns() const; 38 | 39 | void AddExcludedPatterns(const std::wstring&); 40 | const T_Patterns& GetExcludedPatterns() const; 41 | 42 | bool IsRegexCaseSensitiv() const; 43 | 44 | Patterns& operator=(const Patterns&) = default; 45 | 46 | CPPCOVERAGE_DLL friend std::wostream& operator<<(std::wostream&, const Patterns&); 47 | 48 | private: 49 | T_Patterns selectedPatterns_; 50 | T_Patterns excludedPatterns_; 51 | bool isRegexCaseSensitiv_; 52 | }; 53 | } 54 | 55 | -------------------------------------------------------------------------------- /CppCoverage/Process.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "CppCoverageExport.hpp" 23 | #include "StartInfo.hpp" 24 | 25 | namespace CppCoverage 26 | { 27 | class CPPCOVERAGE_DLL Process 28 | { 29 | public: 30 | Process(const StartInfo& startInfo); 31 | ~Process(); 32 | 33 | void Start(DWORD creationFlags); 34 | 35 | private: 36 | Process(const Process&) = delete; 37 | Process& operator=(const Process&) = delete; 38 | 39 | private: 40 | boost::optional processInformation_; 41 | const StartInfo startInfo_; 42 | }; 43 | } 44 | 45 | -------------------------------------------------------------------------------- /CppCoverage/StartInfo.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "CppCoverageExport.hpp" 26 | 27 | namespace CppCoverage 28 | { 29 | class CPPCOVERAGE_DLL StartInfo 30 | { 31 | public: 32 | explicit StartInfo(const boost::filesystem::path&); 33 | 34 | StartInfo(StartInfo&&); 35 | 36 | StartInfo(const StartInfo&) = default; 37 | StartInfo& operator=(const StartInfo&) = default; 38 | 39 | void SetWorkingDirectory(const boost::filesystem::path&); 40 | void AddArgument(const std::wstring&); 41 | 42 | const boost::filesystem::path& GetPath() const; 43 | const std::vector& GetArguments() const; 44 | const boost::filesystem::path* GetWorkingDirectory() const; 45 | 46 | friend CPPCOVERAGE_DLL std::wostream& operator<<(std::wostream& ostr, const StartInfo&); 47 | 48 | private: 49 | boost::filesystem::path path_; 50 | std::vector arguments_; 51 | boost::optional workingDirectory_; 52 | }; 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /CppCoverage/UnifiedDiffSettings.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include "UnifiedDiffSettings.hpp" 19 | 20 | namespace CppCoverage 21 | { 22 | //------------------------------------------------------------------------- 23 | UnifiedDiffSettings::UnifiedDiffSettings( 24 | const boost::filesystem::path& unifiedDiffPath, 25 | const boost::optional& rootDiffFolder) 26 | : unifiedDiffPath_{unifiedDiffPath} 27 | , rootDiffFolder_{rootDiffFolder} 28 | { 29 | } 30 | 31 | //------------------------------------------------------------------------- 32 | const boost::filesystem::path& UnifiedDiffSettings::GetUnifiedDiffPath() const 33 | { 34 | return unifiedDiffPath_; 35 | } 36 | 37 | //------------------------------------------------------------------------- 38 | const boost::optional& UnifiedDiffSettings::GetRootDiffFolder() const 39 | { 40 | return rootDiffFolder_; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /CppCoverage/UnifiedDiffSettings.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "CppCoverageExport.hpp" 23 | 24 | namespace CppCoverage 25 | { 26 | class CPPCOVERAGE_DLL UnifiedDiffSettings 27 | { 28 | public: 29 | UnifiedDiffSettings( 30 | const boost::filesystem::path& unifiedDiffPath, 31 | const boost::optional& rootDiffFolder); 32 | UnifiedDiffSettings(const UnifiedDiffSettings&) = default; 33 | UnifiedDiffSettings(UnifiedDiffSettings&&) = default; 34 | 35 | const boost::filesystem::path& GetUnifiedDiffPath() const; 36 | const boost::optional& GetRootDiffFolder() const; 37 | 38 | UnifiedDiffSettings& operator=(const UnifiedDiffSettings&) = default; 39 | 40 | private: 41 | boost::filesystem::path unifiedDiffPath_; 42 | boost::optional rootDiffFolder_; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /CppCoverage/WildcardCoverageFilter.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "CppCoverageExport.hpp" 24 | 25 | namespace CppCoverage 26 | { 27 | class CoverageFilterSettings; 28 | class Patterns; 29 | 30 | class CPPCOVERAGE_DLL WildcardCoverageFilter 31 | { 32 | public: 33 | explicit WildcardCoverageFilter(const CoverageFilterSettings&); 34 | ~WildcardCoverageFilter(); 35 | 36 | bool IsModuleSelected(const std::wstring& filename) const; 37 | bool IsSourceFileSelected(const std::wstring& filename) const; 38 | 39 | private: 40 | WildcardCoverageFilter(const WildcardCoverageFilter&) = delete; 41 | WildcardCoverageFilter& operator=(const WildcardCoverageFilter&) = delete; 42 | 43 | struct Filter; 44 | 45 | std::unique_ptr BuildFilter(const Patterns& pattern) const; 46 | bool Match( 47 | const std::wstring& str, 48 | const Filter& filter, 49 | std::wostream& ostr) const; 50 | private: 51 | std::unique_ptr moduleFilter_; 52 | std::unique_ptr sourceFilter_; 53 | }; 54 | } 55 | 56 | 57 | -------------------------------------------------------------------------------- /CppCoverage/Wildcards.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "CppCoverageExport.hpp" 23 | 24 | namespace CppCoverage 25 | { 26 | class CPPCOVERAGE_DLL Wildcards 27 | { 28 | public: 29 | static const std::vector EscapedChars; 30 | 31 | public: 32 | explicit Wildcards(std::wstring, bool isRegexCaseSensitiv = false); 33 | Wildcards(Wildcards&&); 34 | 35 | bool Match(const std::wstring& str) const; 36 | 37 | friend CPPCOVERAGE_DLL std::wostream& operator<<(std::wostream&, const Wildcards&); 38 | 39 | private: 40 | Wildcards(const Wildcards&) = delete; 41 | Wildcards& operator=(const Wildcards&) = delete; 42 | 43 | private: 44 | std::wregex wildcars_; 45 | std::wstring originalStr_; 46 | }; 47 | } -------------------------------------------------------------------------------- /CppCoverage/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | 19 | // TODO: reference any additional headers you need in STDAFX.H 20 | // and not in this file 21 | -------------------------------------------------------------------------------- /CppCoverage/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 20 | // Windows Header Files: 21 | #include 22 | 23 | #include 24 | #include 25 | 26 | const int PathBufferSize = 40 * 1000; -------------------------------------------------------------------------------- /CppCoverageCross/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | 3 | set (CMAKE_CXX_STANDARD 14) 4 | 5 | add_library(CppCoverageCross 6 | CoverageData.hpp 7 | CoverageData.cpp 8 | CoverageRate.hpp 9 | CoverageRate.cpp 10 | CoverageRateComputer.hpp 11 | CoverageRateComputer.cpp 12 | CppCoverageException.hpp 13 | CppCoverageException.cpp 14 | CppCoverageExport.hpp 15 | FileCoverage.hpp 16 | FileCoverage.cpp 17 | LineCoverage.hpp 18 | LineCoverage.cpp 19 | ModuleCoverage.hpp 20 | ModuleCoverage.cpp) 21 | 22 | include_directories(${CMAKE_SOURCE_DIR}) 23 | link_directories(${CMAKE_SOURCE_DIR}) -------------------------------------------------------------------------------- /CppCoverageCross/CoverageRate.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverageExport.hpp" 20 | 21 | namespace CppCoverage 22 | { 23 | class CPPCOVERAGE_DLL CoverageRate 24 | { 25 | public: 26 | CoverageRate(); 27 | CoverageRate(int executedLinesCount, int unexecutedLinesCount); 28 | 29 | CoverageRate& operator=(const CoverageRate&) = delete; 30 | CoverageRate(const CoverageRate&) = default; 31 | 32 | int GetExecutedLinesCount() const; 33 | int GetUnExecutedLinesCount() const; 34 | int GetTotalLinesCount() const; 35 | int GetPercentRate() const; 36 | double GetRate() const; 37 | 38 | CoverageRate& operator+=(const CoverageRate&); 39 | 40 | private: 41 | int executedLinesCount_; 42 | int unexecutedLinesCount_; 43 | }; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /CppCoverageCross/CppCoverageException.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "CppCoverageException.hpp" 18 | 19 | #include 20 | #include 21 | #ifdef _WIN32 22 | #include 23 | #elif __linux__ 24 | #include 25 | #endif 26 | 27 | namespace CppCoverage 28 | { 29 | //------------------------------------------------------------------------- 30 | std::wstring GetErrorMessage(int lastErrorCode) 31 | { 32 | std::vector sysMsg(64 * 1024); 33 | std::wostringstream ostr; 34 | #ifdef _WIN_32 35 | if (FormatMessage( 36 | FORMAT_MESSAGE_FROM_SYSTEM, 37 | NULL, lastErrorCode, 38 | MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), 39 | &sysMsg[0], static_cast(sysMsg.size()), NULL)) 40 | { 41 | ostr << &sysMsg[0]; 42 | } 43 | else 44 | { 45 | ostr << "Last error code:" << lastErrorCode; 46 | } 47 | #elif __LINUX__ 48 | ostr << "Last error code:" << lastErrorCode; 49 | #endif 50 | 51 | return ostr.str(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CppCoverageCross/CppCoverageException.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include "CppCoverageExport.hpp" 21 | #include 22 | 23 | namespace CppCoverage 24 | { 25 | CPPCOVERAGE_DLL std::wstring GetErrorMessage(int errorCode); 26 | } 27 | 28 | GENERATE_EXCEPTION_CLASS(CppCoverage, CppCoverageException); 29 | 30 | #define THROW(message) THROW_BASE(CppCoverage, CppCoverageException, message) 31 | #define THROW_LAST_ERROR(message, lastErrorCode) THROW_BASE(CppCoverage, CppCoverageException, message << CppCoverage::GetErrorMessage(lastErrorCode)) 32 | -------------------------------------------------------------------------------- /CppCoverageCross/CppCoverageExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#ifdef CPPCOVERAGE_EXPORTS 20 | //#define CPPCOVERAGE_DLL __declspec(dllexport) 21 | //#else 22 | //#define CPPCOVERAGE_DLL _declspec(dllimport) 23 | #define CPPCOVERAGE_DLL 24 | //#endif 25 | 26 | #pragma warning (disable: 4251) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /CppCoverageCross/FileCoverage.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include "LineCoverage.hpp" 24 | #include "CppCoverageExport.hpp" 25 | 26 | namespace CppCoverage 27 | { 28 | class CPPCOVERAGE_DLL FileCoverage 29 | { 30 | public: 31 | explicit FileCoverage(const boost::filesystem::path& path); 32 | 33 | void AddLine(unsigned int lineNumber, bool hasBeenExecuted); 34 | void UpdateLine(unsigned int lineNumber, bool hasBeenExecuted); 35 | 36 | const boost::filesystem::path& GetPath() const; 37 | const LineCoverage* operator[](unsigned int line) const; 38 | std::vector GetLines() const; 39 | 40 | FileCoverage& operator=(const FileCoverage&) = default; 41 | 42 | private: 43 | FileCoverage(const FileCoverage&) = delete; 44 | 45 | private: 46 | boost::filesystem::path path_; 47 | std::map lines_; 48 | }; 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /CppCoverageCross/LineCoverage.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "LineCoverage.hpp" 18 | 19 | namespace CppCoverage 20 | { 21 | //------------------------------------------------------------------------- 22 | LineCoverage::LineCoverage(unsigned int lineNumber, bool hasBeenExecuted) 23 | : lineNumber_(lineNumber) 24 | , hasBeenExecuted_(hasBeenExecuted) 25 | { 26 | } 27 | 28 | //------------------------------------------------------------------------- 29 | unsigned int LineCoverage::GetLineNumber() const 30 | { 31 | return lineNumber_; 32 | } 33 | 34 | //------------------------------------------------------------------------- 35 | bool LineCoverage::HasBeenExecuted() const 36 | { 37 | return hasBeenExecuted_; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /CppCoverageCross/LineCoverage.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverageExport.hpp" 20 | 21 | namespace CppCoverage 22 | { 23 | class CPPCOVERAGE_DLL LineCoverage 24 | { 25 | public: 26 | LineCoverage(unsigned int lineNumber, bool hasBeenExecuted); 27 | LineCoverage(const LineCoverage&) = default; 28 | 29 | unsigned int GetLineNumber() const; 30 | bool HasBeenExecuted() const; 31 | 32 | private: 33 | unsigned int lineNumber_; 34 | bool hasBeenExecuted_; 35 | }; 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /CppCoverageCross/ModuleCoverage.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "ModuleCoverage.hpp" 18 | 19 | #include "FileCoverage.hpp" 20 | 21 | namespace CppCoverage 22 | { 23 | //------------------------------------------------------------------------- 24 | ModuleCoverage::ModuleCoverage(const boost::filesystem::path& path) 25 | : path_(path) 26 | { 27 | } 28 | 29 | //------------------------------------------------------------------------- 30 | ModuleCoverage::~ModuleCoverage() 31 | { 32 | } 33 | 34 | //------------------------------------------------------------------------- 35 | FileCoverage& ModuleCoverage::AddFile(const boost::filesystem::path& filePath) 36 | { 37 | files_.push_back(std::unique_ptr(new FileCoverage(filePath))); 38 | 39 | return *files_.back(); 40 | } 41 | 42 | //------------------------------------------------------------------------- 43 | const boost::filesystem::path& ModuleCoverage::GetPath() const 44 | { 45 | return path_; 46 | } 47 | 48 | //------------------------------------------------------------------------- 49 | const ModuleCoverage::T_FileCoverageCollection& ModuleCoverage::GetFiles() const 50 | { 51 | return files_; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CppCoverageCross/ModuleCoverage.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | #include "CppCoverageExport.hpp" 25 | 26 | namespace CppCoverage 27 | { 28 | class FileCoverage; 29 | 30 | class CPPCOVERAGE_DLL ModuleCoverage 31 | { 32 | public: 33 | typedef std::vector> T_FileCoverageCollection; 34 | 35 | public: 36 | explicit ModuleCoverage(const boost::filesystem::path& path); 37 | ~ModuleCoverage(); 38 | 39 | FileCoverage& AddFile(const boost::filesystem::path& filename); 40 | 41 | const boost::filesystem::path& GetPath() const; 42 | const T_FileCoverageCollection& GetFiles() const; 43 | 44 | private: 45 | ModuleCoverage(const ModuleCoverage&) = delete; 46 | ModuleCoverage& operator=(const ModuleCoverage&) = delete; 47 | 48 | private: 49 | T_FileCoverageCollection files_; 50 | boost::filesystem::path path_; 51 | }; 52 | } 53 | 54 | 55 | -------------------------------------------------------------------------------- /CppCoverageTest/CoverageFilterManagerMock.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include "CppCoverage/ICoverageFilterManager.hpp" 21 | 22 | namespace CppCoverageTest 23 | { 24 | class CoverageFilterManagerMock : public CppCoverage::ICoverageFilterManager 25 | { 26 | public: 27 | CoverageFilterManagerMock() = default; 28 | 29 | MOCK_CONST_METHOD1(IsModuleSelected, bool(const std::wstring&)); 30 | MOCK_METHOD1(IsSourceFileSelected, bool(const std::wstring&)); 31 | MOCK_METHOD3(IsLineSelected, 32 | bool(const FileFilter::ModuleInfo&, 33 | const FileFilter::FileInfo&, 34 | const FileFilter::LineInfo&)); 35 | 36 | private: 37 | CoverageFilterManagerMock(const CoverageFilterManagerMock&) = delete; 38 | CoverageFilterManagerMock& operator=(const CoverageFilterManagerMock&) = delete; 39 | }; 40 | } 41 | 42 | 43 | -------------------------------------------------------------------------------- /CppCoverageTest/CppCoverageExceptionTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | 19 | #include "CppCoverage/CppCoverageException.hpp" 20 | 21 | namespace cov = CppCoverage; 22 | 23 | namespace CppCoverageTest 24 | { 25 | 26 | //------------------------------------------------------------------------- 27 | TEST(CppCoverageException, GetErrorMessage) 28 | { 29 | ASSERT_NE(L"", cov::GetErrorMessage(1)); 30 | } 31 | 32 | //------------------------------------------------------------------------- 33 | TEST(CppCoverageException, GetErrorMessageInvalid) 34 | { 35 | ASSERT_NE(L"", cov::GetErrorMessage(-1)); 36 | } 37 | } -------------------------------------------------------------------------------- /CppCoverageTest/CppCoverageTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include 19 | 20 | #include "ToolsCross/Log.hpp" 21 | 22 | //----------------------------------------------------------------------------- 23 | int _tmain(int argc, _TCHAR* argv[]) 24 | { 25 | Tools::EnableLogger(false); 26 | ::testing::InitGoogleMock(&argc, argv); 27 | return RUN_ALL_TESTS(); 28 | } 29 | 30 | -------------------------------------------------------------------------------- /CppCoverageTest/Data/TestDiff.diff: -------------------------------------------------------------------------------- 1 | diff --git a/TestCoverageConsole/TestDiff.cpp b/TestCoverageConsole/Tes 2 | index 8944117..c9f2773 100644 3 | --- a/TestCoverageConsole/TestDiff.cpp 4 | +++ b/TestCoverageConsole/TestDiff.cpp 5 | @@ -22,10 +22,10 @@ namespace TestCoverageConsole 6 | void FilterByDiff() 7 | { 8 | int value1 = 0; 9 | - if (true) 10 | - int value2 = 0; 11 | - if (false) 12 | - int value3 = 0; 13 | + if (true) // In Diff 14 | + int value2 = 0; // In Diff 15 | + if (false) // In Diff 16 | + int value3 = 0; // In Diff 17 | int value4 = 0; 18 | } 19 | } 20 | \ No newline at end of file -------------------------------------------------------------------------------- /CppCoverageTest/DebugEventsMock.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverage/IDebugEventsHandler.hpp" 20 | 21 | namespace CppCoverageTest 22 | { 23 | class DebugEventsHandlerMock : public CppCoverage::IDebugEventsHandler 24 | { 25 | public: 26 | DebugEventsHandlerMock() = default; 27 | 28 | MOCK_METHOD1(OnCreateProcess, void(const CREATE_PROCESS_DEBUG_INFO&)); 29 | MOCK_METHOD3(OnExitProcess, void(HANDLE, HANDLE, const EXIT_PROCESS_DEBUG_INFO&)); 30 | MOCK_METHOD3(OnLoadDll, void(HANDLE, HANDLE, const LOAD_DLL_DEBUG_INFO&)); 31 | MOCK_METHOD3(OnUnloadDll, void(HANDLE, HANDLE, const UNLOAD_DLL_DEBUG_INFO&)); 32 | MOCK_METHOD3(OnException, ExceptionType(HANDLE, HANDLE, const EXCEPTION_DEBUG_INFO&)); 33 | 34 | private: 35 | DebugEventsHandlerMock(const DebugEventsHandlerMock&) = delete; 36 | DebugEventsHandlerMock& operator=(const DebugEventsHandlerMock&) = delete; 37 | }; 38 | } -------------------------------------------------------------------------------- /CppCoverageTest/DebugInformationEventHandlerMock.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "CppCoverage/IDebugInformationEventHandler.hpp" 20 | 21 | namespace CppCoverageTest 22 | { 23 | class DebugInformationEventHandlerMock : public CppCoverage::IDebugInformationEventHandler 24 | { 25 | public: 26 | DebugInformationEventHandlerMock() = default; 27 | 28 | MOCK_CONST_METHOD1(IsSourceFileSelected, bool(const std::wstring&)); 29 | MOCK_METHOD3(OnNewLine, void(const std::wstring& fileName, int lineNumber, const CppCoverage::Address&)); 30 | 31 | private: 32 | DebugInformationEventHandlerMock(const DebugInformationEventHandlerMock&) = delete; 33 | DebugInformationEventHandlerMock& operator=(const DebugInformationEventHandlerMock&) = delete; 34 | }; 35 | } 36 | 37 | 38 | -------------------------------------------------------------------------------- /CppCoverageTest/HandleInformationTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | 19 | #include 20 | 21 | #include "CppCoverage/HandleInformation.hpp" 22 | #include "TestCoverageConsole/TestCoverageConsole.hpp" 23 | #include "ToolsCross/Tool.hpp" 24 | 25 | #include "TestTools.hpp" 26 | 27 | namespace cov = CppCoverage; 28 | namespace fs = boost::filesystem; 29 | 30 | namespace CppCoverageTest 31 | { 32 | //------------------------------------------------------------------------- 33 | TEST(HandleInformationTest, ComputeFilename) 34 | { 35 | auto outputBinaryPath = TestCoverageConsole::GetOutputBinaryPath(); 36 | fs::path path; 37 | 38 | TestTools::GetHandles(outputBinaryPath, [&](HANDLE hProcess, HANDLE hFile) 39 | { 40 | cov::HandleInformation handleInformation; 41 | 42 | path = handleInformation.ComputeFilename(hFile); 43 | }); 44 | 45 | ASSERT_EQ(outputBinaryPath, path); 46 | } 47 | } -------------------------------------------------------------------------------- /CppCoverageTest/ProcessTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | 19 | #include "CppCoverage/StartInfo.hpp" 20 | #include "CppCoverage/Process.hpp" 21 | 22 | #include "TestCoverageConsole/TestCoverageConsole.hpp" 23 | #include "TestCoverageSharedLib/TestCoverageSharedLib.hpp" 24 | 25 | namespace cov = CppCoverage; 26 | 27 | namespace CppCoverageTest 28 | { 29 | //------------------------------------------------------------------------- 30 | TEST(Process, StartWithArgument) 31 | { 32 | cov::StartInfo startInfo{ TestCoverageConsole::GetOutputBinaryPath() }; 33 | startInfo.AddArgument(TestCoverageConsole::TestThrowHandledException); 34 | 35 | cov::Process process{ startInfo }; 36 | ASSERT_NO_THROW(process.Start(0)); 37 | } 38 | 39 | //------------------------------------------------------------------------- 40 | TEST(Process, InvalidProgram) 41 | { 42 | cov::StartInfo startInfo{ TestCoverageSharedLib::GetOutputBinaryPath() }; 43 | 44 | cov::Process process{ startInfo }; 45 | ASSERT_THROW(process.Start(0), std::runtime_error); 46 | } 47 | } -------------------------------------------------------------------------------- /CppCoverageTest/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : CppCoverageTest Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this CppCoverageTest application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your CppCoverageTest application. 9 | 10 | 11 | CppCoverageTest.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | CppCoverageTest.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | CppCoverageTest.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named CppCoverageTest.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /CppCoverageTest/TestTools.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | 24 | #include "CppCoverage/OptionsParser.hpp" 25 | #include "CppCoverage/Options.hpp" 26 | 27 | namespace boost 28 | { 29 | namespace filesystem 30 | { 31 | class path; 32 | } 33 | } 34 | 35 | namespace CppCoverageTest 36 | { 37 | class TestTools 38 | { 39 | public: 40 | typedef std::function T_HandlesFct; 41 | 42 | public: 43 | TestTools() = delete; 44 | 45 | static void GetHandles(const boost::filesystem::path&, T_HandlesFct); 46 | 47 | static boost::optional Parse( 48 | const CppCoverage::OptionsParser& parser, 49 | const std::vector& arguments, 50 | bool appendProgramToRun = true, 51 | std::wostream* emptyOptionsExplanation = nullptr); 52 | 53 | static const std::string OptionPrefix; 54 | static const std::string ProgramToRun; 55 | }; 56 | } 57 | 58 | -------------------------------------------------------------------------------- /CppCoverageTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /CppCoverageTest/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include -------------------------------------------------------------------------------- /Exporter/Binary/BinaryExporter.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "../stdafx.h" 18 | #include "BinaryExporter.hpp" 19 | 20 | #include 21 | 22 | #include 23 | 24 | #include "CoverageDataSerializer.hpp" 25 | #ifdef __linux__ 26 | #include 27 | #elif _WIN32 28 | #include 29 | #endif 30 | 31 | namespace Exporter 32 | { 33 | //------------------------------------------------------------------------- 34 | boost::filesystem::path BinaryExporter::GetDefaultPath(const std::wstring& prefix) const 35 | { 36 | boost::filesystem::path path{ prefix }; 37 | 38 | path += ".cov"; 39 | 40 | return path; 41 | } 42 | 43 | //------------------------------------------------------------------------- 44 | void BinaryExporter::Export( 45 | const CppCoverage::CoverageData& coverageData, 46 | const boost::filesystem::path& output) 47 | { 48 | CoverageDataSerializer coverageDataSerializer; 49 | 50 | coverageDataSerializer.Serialize(coverageData, output); 51 | Tools::ShowOutputMessage(L"Coverage binary generated in file: ", output); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Exporter/Binary/BinaryExporter.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "../ExporterExport.hpp" 20 | #include "../IExporter.hpp" 21 | 22 | namespace Exporter 23 | { 24 | class EXPORTER_DLL BinaryExporter : public IExporter 25 | { 26 | public: 27 | BinaryExporter() = default; 28 | 29 | boost::filesystem::path GetDefaultPath(const std::wstring& prefix) const override; 30 | void Export(const CppCoverage::CoverageData&, const boost::filesystem::path& output) override; 31 | 32 | private: 33 | BinaryExporter(const BinaryExporter&) = delete; 34 | BinaryExporter& operator=(const BinaryExporter&) = delete; 35 | }; 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Exporter/Binary/CoverageData.proto: -------------------------------------------------------------------------------- 1 | package ProtoBuff; 2 | 3 | message LineCoverage 4 | { 5 | required uint32 lineNumber = 1; 6 | required bool hasBeenExecuted = 2; 7 | } 8 | 9 | message FileCoverage 10 | { 11 | required string path = 1; 12 | repeated LineCoverage lines = 2; 13 | } 14 | 15 | message ModuleCoverage 16 | { 17 | required string path = 1; 18 | repeated FileCoverage files = 2; 19 | } 20 | 21 | message CoverageData 22 | { 23 | required string name = 1; 24 | required int32 exitCode = 2; 25 | required uint64 moduleCount = 3; 26 | } -------------------------------------------------------------------------------- /Exporter/Binary/CoverageDataDeserializer.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "../ExporterExport.hpp" 20 | 21 | namespace boost 22 | { 23 | namespace filesystem 24 | { 25 | class path; 26 | } 27 | } 28 | 29 | namespace CppCoverage 30 | { 31 | class CoverageData; 32 | } 33 | 34 | namespace Exporter 35 | { 36 | class EXPORTER_DLL CoverageDataDeserializer 37 | { 38 | public: 39 | CoverageDataDeserializer() = default; 40 | 41 | CppCoverage::CoverageData Deserialize(const boost::filesystem::path&, const std::string& errorIfNotCorrectFormat) const; 42 | 43 | private: 44 | CoverageDataDeserializer(const CoverageDataDeserializer&) = delete; 45 | CoverageDataDeserializer& operator=(const CoverageDataDeserializer&) = delete; 46 | }; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /Exporter/Binary/CoverageDataSerializer.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "../ExporterExport.hpp" 20 | 21 | namespace CppCoverage 22 | { 23 | class CoverageData; 24 | } 25 | 26 | namespace boost 27 | { 28 | namespace filesystem 29 | { 30 | class path; 31 | } 32 | } 33 | 34 | namespace Exporter 35 | { 36 | class EXPORTER_DLL CoverageDataSerializer 37 | { 38 | public: 39 | const static unsigned int FileTypeId; 40 | 41 | CoverageDataSerializer() = default; 42 | 43 | void Serialize(const CppCoverage::CoverageData&, const boost::filesystem::path&) const; 44 | 45 | private: 46 | CoverageDataSerializer(const CoverageDataSerializer&) = delete; 47 | CoverageDataSerializer& operator=(const CoverageDataSerializer&) = delete; 48 | }; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Exporter/Binary/ProtoBuff.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #pragma warning(push) 20 | 21 | #pragma warning(disable: 4244) // conversion from '__int64' to 'int', possible loss of data 22 | 23 | #include 24 | #include 25 | 26 | #pragma warning(pop) 27 | 28 | 29 | -------------------------------------------------------------------------------- /Exporter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | 3 | set(CMAKE_CXX_STANDARD 14) 4 | 5 | find_package(Protobuf REQUIRED) 6 | include_directories(${CMAKE_SOURCE_DIR} 7 | ${PROTOBUF_INCLUDE_DIRS} 8 | /home/nicklas/Downloads/ctemplate-ctemplate-2.3/src) 9 | 10 | PROTOBUF_GENERATE_CPP(PROTO_SRC PROTO_HEADER Binary/CoverageData.proto) 11 | 12 | set_source_files_properties(${PROTO_SRC} ${PROTO_HEADER} PROPERTIES GENERATED TRUE) 13 | 14 | add_library(Exporter 15 | ${PROTO_SRC} 16 | ${PROTO_HEADER} 17 | CoberturaExporter.cpp 18 | CoberturaExporter.hpp 19 | ExporterException.cpp 20 | ExporterException.hpp 21 | ExporterExport.hpp 22 | IExporter.hpp 23 | stdafx.cpp 24 | stdafx.h 25 | Binary/BinaryExporter.cpp 26 | Binary/BinaryExporter.hpp 27 | Binary/CoverageDataDeserializer.cpp 28 | Binary/CoverageDataDeserializer.hpp 29 | Binary/CoverageDataSerializer.cpp 30 | Binary/CoverageDataSerializer.hpp 31 | Binary/ProtoBuff.hpp 32 | Html/CTemplate.hpp 33 | Html/HtmlExporter.cpp 34 | Html/HtmlExporter.hpp 35 | Html/HtmlFile.cpp 36 | Html/HtmlFile.hpp 37 | Html/HtmlFileCoverageExporter.cpp 38 | Html/HtmlFileCoverageExporter.hpp 39 | Html/HtmlFolderStructure.cpp 40 | Html/HtmlFolderStructure.hpp 41 | Html/TemplateHtmlExporter.cpp 42 | Html/TemplateHtmlExporter.hpp 43 | ) 44 | 45 | link_directories(${CMAKE_SOURCE_DIR} ${PROTOBUF_LIBRARIES}) -------------------------------------------------------------------------------- /Exporter/CoberturaExporter.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "ExporterExport.hpp" 22 | #include "IExporter.hpp" 23 | 24 | namespace CppCoverage 25 | { 26 | class CoverageData; 27 | } 28 | 29 | namespace boost 30 | { 31 | namespace filesystem 32 | { 33 | class path; 34 | } 35 | } 36 | 37 | namespace Exporter 38 | { 39 | class EXPORTER_DLL CoberturaExporter: public IExporter 40 | { 41 | public: 42 | CoberturaExporter() ; 43 | 44 | boost::filesystem::path GetDefaultPath(const std::wstring& runningCommandFilename) const override; 45 | void Export(const CppCoverage::CoverageData&, const boost::filesystem::path& output) override; 46 | void Export(const CppCoverage::CoverageData&, std::wostream&) const; 47 | 48 | private: 49 | CoberturaExporter(const CoberturaExporter&) = delete; 50 | CoberturaExporter& operator=(const CoberturaExporter&) = delete; 51 | }; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Exporter/ExporterException.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include "ExporterException.hpp" 19 | 20 | namespace Exporter 21 | { 22 | } -------------------------------------------------------------------------------- /Exporter/ExporterException.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | GENERATE_EXCEPTION_CLASS(Exporter, ExporterException); 22 | 23 | #define THROW(message) THROW_BASE(Exporter, ExporterException, message) 24 | 25 | -------------------------------------------------------------------------------- /Exporter/ExporterExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#ifdef EXPORTER_EXPORTS 20 | //#define EXPORTER_DLL __declspec(dllexport) 21 | //#else 22 | //#define EXPORTER_DLL _declspec(dllimport) 23 | #define EXPORTER_DLL 24 | //#endif 25 | 26 | #pragma warning (disable: 4251) 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Exporter/Html/CTemplate.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #pragma warning(push) 20 | 21 | #pragma warning(disable: 4005) // 'va_copy' : macro redefinition 22 | #pragma warning(disable: 4251) // needs to have dll-interface to be used by clients of class 23 | #pragma warning(disable: 4273) // inconsistent dll linkage 24 | #pragma warning(disable: 4267) // 'initializing' : conversion from 'size_t' to 'int' 25 | 26 | //template std::vector; // To avoid error C4251 27 | #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 28 | #define __MINGW64__ // disable snprintf 29 | #include 30 | #include 31 | #undef _SILENCE_STDEXT_HASH_DEPRECATION_WARNING 32 | #undef __MINGW64__ 33 | 34 | #pragma warning(pop) 35 | -------------------------------------------------------------------------------- /Exporter/Html/HtmlFile.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "../stdafx.h" 18 | #include "HtmlFile.hpp" 19 | 20 | namespace Exporter 21 | { 22 | //------------------------------------------------------------------------- 23 | HtmlFile::HtmlFile( 24 | boost::filesystem::path absolutePath, 25 | boost::filesystem::path relativeLinkPath) 26 | : absolutePath_(absolutePath) 27 | , relativeLinkPath_(relativeLinkPath) 28 | { 29 | } 30 | 31 | //------------------------------------------------------------------------- 32 | const boost::filesystem::path& HtmlFile::GetAbsolutePath() const 33 | { 34 | return absolutePath_; 35 | } 36 | 37 | //------------------------------------------------------------------------- 38 | const boost::filesystem::path& HtmlFile::GetRelativeLinkPath() const 39 | { 40 | return relativeLinkPath_; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Exporter/Html/HtmlFile.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "../ExporterExport.hpp" 22 | 23 | namespace Exporter 24 | { 25 | class EXPORTER_DLL HtmlFile 26 | { 27 | public: 28 | HtmlFile( 29 | boost::filesystem::path absolutePath, 30 | boost::filesystem::path relativeLinkPath); 31 | HtmlFile(const HtmlFile&) = default; 32 | 33 | const boost::filesystem::path& GetAbsolutePath() const; 34 | const boost::filesystem::path& GetRelativeLinkPath() const; 35 | 36 | private: 37 | HtmlFile& operator=(const HtmlFile&) = delete; 38 | 39 | boost::filesystem::path absolutePath_; 40 | boost::filesystem::path relativeLinkPath_; 41 | }; 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Exporter/Html/HtmlFolderStructure.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include "HtmlFile.hpp" 23 | #include "../ExporterExport.hpp" 24 | 25 | namespace Exporter 26 | { 27 | class EXPORTER_DLL HtmlFolderStructure 28 | { 29 | public: 30 | static const std::wstring ThirdParty; 31 | static const std::wstring FolderModules; 32 | 33 | public: 34 | HtmlFolderStructure(const boost::filesystem::path& templateFolder); 35 | ~HtmlFolderStructure(); 36 | 37 | boost::filesystem::path CreateCurrentRoot(const boost::filesystem::path& outputFolder); 38 | HtmlFile CreateCurrentModule(const boost::filesystem::path&); 39 | HtmlFile GetHtmlFilePath(const boost::filesystem::path& filePath) const; 40 | 41 | private: 42 | HtmlFolderStructure(const HtmlFolderStructure&) = delete; 43 | HtmlFolderStructure& operator=(const HtmlFolderStructure&) = delete; 44 | 45 | private: 46 | boost::filesystem::path templateFolder_; 47 | 48 | struct Hierarchy; 49 | std::unique_ptr optionalCurrentRoot_; 50 | std::unique_ptr optionalCurrentModule_; 51 | }; 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Exporter/Html/Template/SourceTemplate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{TITLE}} 6 | 7 | 8 | 9 | 10 |

{{SOURCE_WARNING_MESSAGE}}

11 |
{{CODE}}
12 | 13 | -------------------------------------------------------------------------------- /Exporter/Html/Template/third-party/css/style.css: -------------------------------------------------------------------------------- 1 | /* ------------------ 2 | styling from http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs/ 3 | ------------------ */ 4 | 5 | #rounded-corner 6 | { 7 | font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif; 8 | font-size: 12px; 9 | margin: 45px; 10 | width: 90%; 11 | text-align: left; 12 | border-collapse: collapse; 13 | } 14 | #rounded-corner thead th.rounded-left 15 | { 16 | background: #b9c9fe url('table-images/left.png') left -1px no-repeat; 17 | } 18 | #rounded-corner thead th.rounded-right 19 | { 20 | background: #b9c9fe url('table-images/right.png') right -1px no-repeat; 21 | } 22 | #rounded-corner th 23 | { 24 | padding: 8px; 25 | font-weight: normal; 26 | font-size: 13px; 27 | color: #039; 28 | background: #b9c9fe; 29 | } 30 | #rounded-corner td 31 | { 32 | padding: 8px; 33 | background: #e8edff; 34 | border-top: 1px solid #fff; 35 | color: #669; 36 | } 37 | #rounded-corner tfoot td.rounded-foot-left 38 | { 39 | background: #e8edff url('table-images/botleft.png') left bottom no-repeat; 40 | } 41 | #rounded-corner tfoot td.rounded-foot-right 42 | { 43 | background: #e8edff url('table-images/botright.png') right bottom no-repeat; 44 | } 45 | #rounded-corner tbody tr:hover td 46 | { 47 | background: #d0dafd; 48 | } -------------------------------------------------------------------------------- /Exporter/Html/Template/third-party/css/table-images/botleft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/OpenCppCoverage/4ae21f3f0bce5a6b305f584b3ef9d9c2cd7c5545/Exporter/Html/Template/third-party/css/table-images/botleft.png -------------------------------------------------------------------------------- /Exporter/Html/Template/third-party/css/table-images/botright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/OpenCppCoverage/4ae21f3f0bce5a6b305f584b3ef9d9c2cd7c5545/Exporter/Html/Template/third-party/css/table-images/botright.png -------------------------------------------------------------------------------- /Exporter/Html/Template/third-party/css/table-images/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/OpenCppCoverage/4ae21f3f0bce5a6b305f584b3ef9d9c2cd7c5545/Exporter/Html/Template/third-party/css/table-images/left.png -------------------------------------------------------------------------------- /Exporter/Html/Template/third-party/css/table-images/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/OpenCppCoverage/4ae21f3f0bce5a6b305f584b3ef9d9c2cd7c5545/Exporter/Html/Template/third-party/css/table-images/right.png -------------------------------------------------------------------------------- /Exporter/Html/Template/third-party/google-code-prettify/prettify-CppCoverage.css: -------------------------------------------------------------------------------- 1 | .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} -------------------------------------------------------------------------------- /Exporter/IExporter.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace boost 22 | { 23 | namespace filesystem 24 | { 25 | class path; 26 | } 27 | } 28 | 29 | namespace CppCoverage 30 | { 31 | class CoverageData; 32 | } 33 | 34 | namespace Exporter 35 | { 36 | class EXPORTER_DLL IExporter 37 | { 38 | public: 39 | IExporter() = default; 40 | 41 | virtual boost::filesystem::path GetDefaultPath(const std::wstring& prefix) const = 0; 42 | virtual void Export(const CppCoverage::CoverageData&, const boost::filesystem::path& output) = 0; 43 | 44 | private: 45 | IExporter(const IExporter&) = delete; 46 | IExporter& operator=(const IExporter&) = delete; 47 | }; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /Exporter/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /Exporter/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 9 | // Windows Header Files: 10 | //#include 11 | 12 | #include 13 | #include 14 | 15 | // TODO: reference additional headers your program requires here 16 | -------------------------------------------------------------------------------- /ExporterTest/CoberturaExporterTest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/OpenCppCoverage/4ae21f3f0bce5a6b305f584b3ef9d9c2cd7c5545/ExporterTest/CoberturaExporterTest.cpp -------------------------------------------------------------------------------- /ExporterTest/CoverageDataSerializerTest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/OpenCppCoverage/4ae21f3f0bce5a6b305f584b3ef9d9c2cd7c5545/ExporterTest/CoverageDataSerializerTest.cpp -------------------------------------------------------------------------------- /ExporterTest/Data/CoberturaExporterExpectedResult.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /ExporterTest/Data/TestFile1.cpp: -------------------------------------------------------------------------------- 1 | void foo() 2 | { 3 | } -------------------------------------------------------------------------------- /ExporterTest/Data/TestFile2.cpp: -------------------------------------------------------------------------------- 1 | void foo() 2 | { 3 | } -------------------------------------------------------------------------------- /ExporterTest/ExporterTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include 19 | 20 | #include "ToolsCross/Log.hpp" 21 | 22 | //----------------------------------------------------------------------------- 23 | int _tmain(int argc, _TCHAR* argv[]) 24 | { 25 | Tools::EnableLogger(false); 26 | ::testing::InitGoogleMock(&argc, argv); 27 | return RUN_ALL_TESTS(); 28 | } -------------------------------------------------------------------------------- /ExporterTest/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : ExporterTest Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this ExporterTest application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your ExporterTest application. 9 | 10 | 11 | ExporterTest.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | ExporterTest.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | ExporterTest.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named ExporterTest.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /ExporterTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /ExporterTest/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /FileFilter/IRelocationsExtractor.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include "FileFilterCross/FileFilterExport.hpp" 22 | 23 | namespace FileFilter 24 | { 25 | class FILEFILTER_DLL IRelocationsExtractor 26 | { 27 | public: 28 | ~IRelocationsExtractor() {} 29 | virtual std::unordered_set Extract( 30 | HANDLE hProcess, 31 | DWORD64 baseOfImage, 32 | DWORD64 baseAddress) const = 0; 33 | }; 34 | } -------------------------------------------------------------------------------- /FileFilter/LineInfo.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace FileFilter 23 | { 24 | class LineInfo 25 | { 26 | public: 27 | LineInfo( 28 | int lineNumber, 29 | DWORD64 lineAddress, 30 | ULONG symbolIndex, 31 | const std::wstring& symbolName) 32 | : lineNumber_{ lineNumber } 33 | , lineAddress_{ lineAddress } 34 | , symbolIndex_{ symbolIndex } 35 | , symbolName_{ symbolName } 36 | {} 37 | 38 | const int lineNumber_; 39 | const DWORD64 lineAddress_; 40 | const ULONG symbolIndex_; 41 | const std::wstring symbolName_; 42 | }; 43 | } -------------------------------------------------------------------------------- /FileFilter/RelocationsExtractor.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include "FileFilterCross/FileFilterExport.hpp" 22 | #include "IRelocationsExtractor.hpp" 23 | 24 | namespace FileFilter 25 | { 26 | class IRelocationsExtractor; 27 | 28 | class FILEFILTER_DLL RelocationsExtractor: public IRelocationsExtractor 29 | { 30 | public: 31 | std::unordered_set Extract( 32 | HANDLE hProcess, 33 | DWORD64 baseOfImage, 34 | DWORD64 baseAddress) const; 35 | }; 36 | } -------------------------------------------------------------------------------- /FileFilter/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 9 | // Windows Header Files: 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | -------------------------------------------------------------------------------- /FileFilterCross/AmbiguousPathException.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "FileFilterExport.hpp" 20 | #include 21 | 22 | #pragma warning(push) 23 | #pragma warning(disable: 4275) // warning C4275: non dll-interface class 'std::exception' used as base for dll-interface class 24 | 25 | namespace FileFilter 26 | { 27 | class FILEFILTER_DLL AmbiguousPathException : public std::runtime_error 28 | { 29 | public: 30 | AmbiguousPathException( 31 | const boost::filesystem::path& postFixPath, 32 | const boost::filesystem::path& firstPossiblePath, 33 | const boost::filesystem::path& secondPossiblePath); 34 | 35 | AmbiguousPathException(const AmbiguousPathException&) = default; 36 | 37 | const boost::filesystem::path& GetPostFixPath() const; 38 | const boost::filesystem::path& GetFirstPossiblePath() const; 39 | const boost::filesystem::path& GetSecondPossiblePath() const; 40 | 41 | private: 42 | boost::filesystem::path postFixPath_; 43 | boost::filesystem::path firstPossiblePath_; 44 | boost::filesystem::path secondPossiblePath_; 45 | }; 46 | } 47 | 48 | #pragma warning(pop) 49 | 50 | -------------------------------------------------------------------------------- /FileFilterCross/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | 3 | set(CMAKE_CXX_STANDARD 14) 4 | 5 | add_library(FileFilterCross 6 | AmbiguousPathException.cpp 7 | AmbiguousPathException.hpp 8 | File.cpp 9 | File.hpp 10 | FileFilterException.hpp 11 | FileFilterExport.hpp 12 | FileInfo.hpp 13 | ModuleInfo.hpp 14 | PathMatcher.cpp 15 | PathMatcher.hpp 16 | stdafx.cpp 17 | stdafx.h 18 | UnifiedDiffCoverageFilter.cpp 19 | UnifiedDiffCoverageFilter.hpp 20 | UnifiedDiffParser.cpp 21 | UnifiedDiffParser.hpp 22 | UnifiedDiffParserException.cpp 23 | UnifiedDiffParserException.hpp 24 | ) 25 | 26 | if(Boost_FOUND) 27 | message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") 28 | message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}") 29 | message(STATUS "Boost_VERSION: ${Boost_VERSION}") 30 | include_directories(${PROJECT_SOURCE_DIR} ${Boost_INCLUDE_DIRS}) 31 | 32 | target_link_libraries(FileFilterCross 33 | ${Boost_LIBRARIES} 34 | ) 35 | endif() 36 | 37 | include_directories(${CMAKE_SOURCE_DIR}) 38 | link_directories(${CMAKE_SOURCE_DIR}) -------------------------------------------------------------------------------- /FileFilterCross/File.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "FileFilterExport.hpp" 20 | #include 21 | #include 22 | 23 | namespace FileFilter 24 | { 25 | class FILEFILTER_DLL File 26 | { 27 | public: 28 | explicit File(const boost::filesystem::path&); 29 | File(File&&) = default; 30 | File& operator=(File&&) = default; 31 | 32 | void AddSelectedLines(const std::vector&); 33 | 34 | const boost::filesystem::path& GetPath() const; 35 | void SetPath(const boost::filesystem::path&); 36 | 37 | bool IsLineSelected(int) const; 38 | const std::set& GetSelectedLines() const; 39 | 40 | bool operator==(const File&) const; 41 | 42 | File operator* (const File &file) { return *this; } 43 | 44 | private: 45 | File(const File&) = default; 46 | File& operator=(const File&) = delete; 47 | 48 | boost::filesystem::path path_; 49 | std::set selectedLines_; 50 | }; 51 | } 52 | 53 | -------------------------------------------------------------------------------- /FileFilterCross/FileFilterException.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | GENERATE_EXCEPTION_CLASS(FileFilter, FileFilterException); 22 | 23 | #define THROW(message) THROW_BASE(FileFilter, FileFilterException, message) 24 | 25 | -------------------------------------------------------------------------------- /FileFilterCross/FileFilterExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#ifdef FILEFILTER_EXPORTS 20 | //#define FILEFILTER_DLL __declspec(dllexport) 21 | //#else 22 | //#define FILEFILTER_DLL _declspec(dllimport) 23 | #define FILEFILTER_DLL 24 | //#endif 25 | 26 | #pragma warning (disable: 4251) -------------------------------------------------------------------------------- /FileFilterCross/FileInfo.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#include 20 | #include 21 | #include 22 | 23 | #include "FileFilter/LineInfo.hpp" 24 | 25 | namespace FileFilter 26 | { 27 | class FileInfo 28 | { 29 | public: 30 | FileInfo( 31 | const boost::filesystem::path& filePath, 32 | std::vector&& lineInfoColllection) 33 | : filePath_{ filePath } 34 | , lineInfoColllection_{ std::move(lineInfoColllection) } 35 | {} 36 | 37 | const boost::filesystem::path filePath_; 38 | const std::vector lineInfoColllection_; 39 | }; 40 | } 41 | -------------------------------------------------------------------------------- /FileFilterCross/ModuleInfo.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace FileFilter 23 | { 24 | class ModuleInfo 25 | { 26 | public: 27 | //--------------------------------------------------------------------------- 28 | ModuleInfo( 29 | HANDLE hProcess, 30 | const boost::uuids::uuid& uniqueId, 31 | void* baseOfImage, 32 | DWORD64 baseAddress) 33 | : hProcess_ {hProcess} 34 | , uniqueId_{ uniqueId } 35 | , baseOfImage_{ baseOfImage } 36 | , baseAddress_{ baseAddress } 37 | {} 38 | 39 | const HANDLE hProcess_; 40 | const boost::uuids::uuid uniqueId_; 41 | void* const baseOfImage_; 42 | const DWORD64 baseAddress_; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /FileFilterCross/PathMatcher.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "FileFilterExport.hpp" 20 | #include 21 | #include 22 | #include 23 | 24 | namespace boost 25 | { 26 | namespace filesystem 27 | { 28 | class path; 29 | } 30 | } 31 | 32 | namespace FileFilter 33 | { 34 | class File; 35 | 36 | class FILEFILTER_DLL PathMatcher 37 | { 38 | public: 39 | explicit PathMatcher( 40 | std::vector&&, 41 | const boost::optional& parentPath); 42 | ~PathMatcher(); 43 | 44 | File* Match(const boost::filesystem::path&); 45 | 46 | using PathCollection = std::vector; 47 | PathCollection GetUnmatchedPaths() const; 48 | 49 | private: 50 | PathMatcher(const PathMatcher&) = delete; 51 | PathMatcher& operator=(const PathMatcher&) = delete; 52 | PathMatcher(PathMatcher&&) = delete; 53 | PathMatcher& operator=(PathMatcher&&) = delete; 54 | 55 | class IPathMatcherEngine; 56 | class PostFixPathMatcherEngine; 57 | class FullPathMatcherEngine; 58 | 59 | std::unique_ptr pathMatcherEngine_; 60 | }; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /FileFilterCross/UnifiedDiffParserException.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "FileFilterExport.hpp" 20 | #include 21 | #include 22 | 23 | #pragma warning(push) 24 | #pragma warning(disable: 4275) // warning C4275: non dll-interface class 'std::exception' used as base for dll-interface class 25 | 26 | namespace FileFilter 27 | { 28 | class FILEFILTER_DLL UnifiedDiffParserException : public std::runtime_error 29 | { 30 | public: 31 | static const std::wstring ErrorContextHunks; 32 | static const std::wstring ErrorNoFilenameBeforeHunks; 33 | static const std::wstring ErrorCannotReadLine; 34 | static const std::wstring ErrorExpectFromFilePrefix; 35 | static const std::wstring ErrorInvalidHunks; 36 | 37 | explicit UnifiedDiffParserException(const std::wstring& message); 38 | }; 39 | } 40 | 41 | #pragma warning(pop) 42 | 43 | -------------------------------------------------------------------------------- /FileFilterCross/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /FileFilterCross/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 9 | // Windows Header Files: 10 | //#include 11 | 12 | #include 13 | #include 14 | 15 | -------------------------------------------------------------------------------- /FileFilterTest/Data/test_add.diff: -------------------------------------------------------------------------------- 1 | diff --git a/FileFilter/stdafx.h b/FileFilter/stdafx.h 2 | new file mode 100644 3 | index 0000000..293d34a 4 | --- /dev/null 5 | +++ b/FileFilter/stdafx.h 6 | @@ -0,0 +1,14 @@ 7 | +// stdafx.h : include file for standard system include files, 8 | +// or project specific include files that are used frequently, but 9 | +// are changed infrequently 10 | +// 11 | + 12 | +#pragma once 13 | + 14 | +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 15 | +// Windows Header Files: 16 | +#include 17 | + 18 | +#include 19 | +#include 20 | + -------------------------------------------------------------------------------- /FileFilterTest/FileFilterTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include 19 | 20 | //----------------------------------------------------------------------------- 21 | int _tmain(int argc, _TCHAR* argv[]) 22 | { 23 | ::testing::InitGoogleMock(&argc, argv); 24 | return RUN_ALL_TESTS(); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /FileFilterTest/Tools.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include "FileFilter/File.hpp" 19 | 20 | namespace FileFilterTest 21 | { 22 | //----------------------------------------------------------------- 23 | std::vector ToFiles(const std::vector& filenames) 24 | { 25 | std::vector files; 26 | 27 | for (auto& filename : filenames) 28 | files.emplace_back(filename); 29 | 30 | return files; 31 | } 32 | } -------------------------------------------------------------------------------- /FileFilterTest/Tools.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace FileFilter 23 | { 24 | class File; 25 | } 26 | 27 | namespace FileFilterTest 28 | { 29 | std::vector ToFiles(const std::vector& filenames); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /FileFilterTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // FileFilterTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | -------------------------------------------------------------------------------- /FileFilterTest/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | -------------------------------------------------------------------------------- /IntegrationTests.testsettings: -------------------------------------------------------------------------------- 1 |  2 | 3 | This test run configuration uses the VS IDE host type in the test run. 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /OpenCppCoverage/OpenCppCoverage.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace OpenCppCoverage 22 | { 23 | class OpenCppCoverage 24 | { 25 | public: 26 | OpenCppCoverage() = default; 27 | 28 | int Run(int argc, const char** argv, std::wostream* emptyOptionsExplanation) const; 29 | 30 | private: 31 | OpenCppCoverage(const OpenCppCoverage&) = delete; 32 | OpenCppCoverage& operator=(const OpenCppCoverage&) = delete; 33 | }; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /OpenCppCoverage/OpenCppCoverageException.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "tools/ExceptionBase.hpp" 20 | 21 | GENERATE_EXCEPTION_CLASS(CppCoverageConsole, CppCoverageConsoleException); 22 | 23 | #define THROW(message) THROW_BASE(CppCoverageConsole, CppCoverageConsoleException, message) 24 | 25 | -------------------------------------------------------------------------------- /OpenCppCoverage/OpenCppCoverageExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#ifdef OPEN_CPP_COVERAGE_EXPORTS 20 | //#define OPEN_CPP_COVERAGE_DLL __declspec(dllexport) 21 | //#else 22 | //#define OPEN_CPP_COVERAGE_DLL _declspec(dllimport) 23 | //#endif 24 | #define OPEN_CPP_COVERAGE_DLL 25 | 26 | #pragma warning (disable: 4251) -------------------------------------------------------------------------------- /OpenCppCoverage/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : CppCoverageConsole Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this CppCoverageConsole application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your CppCoverageConsole application. 9 | 10 | 11 | CppCoverageConsole.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | CppCoverageConsole.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | CppCoverageConsole.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named CppCoverageConsole.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /OpenCppCoverage/main.cpp: -------------------------------------------------------------------------------- 1 | // CppCoverageConsole.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | // OpenCppCoverage is an open source code coverage for C++. 5 | // Copyright (C) 2014 OpenCppCoverage 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | 20 | #include "stdafx.h" 21 | 22 | #include 23 | #include 24 | 25 | #ifdef _WIN32 26 | #include 27 | #elif __linux__ 28 | #include 29 | #endif 30 | 31 | #include "OpenCppCoverage.hpp" 32 | 33 | //----------------------------------------------------------------------------- 34 | int main(int argc, const char* argv[]) 35 | { 36 | Tools::CreateMiniDumpOnUnHandledException(); 37 | 38 | try 39 | { 40 | OpenCppCoverage::OpenCppCoverage openCppCoverage; 41 | 42 | return openCppCoverage.Run(argc, argv, &std::wcerr); 43 | } 44 | catch (const std::exception& e) 45 | { 46 | std::cerr << "Error: " << e.what() << std::endl; 47 | } 48 | 49 | return 1; 50 | } -------------------------------------------------------------------------------- /OpenCppCoverage/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /OpenCppCoverage/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /OpenCppCoverageTest/OpenCppCoverageTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include 19 | 20 | //----------------------------------------------------------------------------- 21 | int _tmain(int argc, _TCHAR* argv[]) 22 | { 23 | ::testing::InitGoogleMock(&argc, argv); 24 | return RUN_ALL_TESTS(); 25 | } 26 | -------------------------------------------------------------------------------- /OpenCppCoverageTest/OpenCppCoverageTestTools.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace boost 23 | { 24 | namespace filesystem 25 | { 26 | class path; 27 | } 28 | } 29 | 30 | namespace OpenCppCoverageTest 31 | { 32 | void AddDefaultFilters( 33 | std::vector>& coverageArguments, 34 | const boost::filesystem::path& programToRun); 35 | 36 | void AddDefaultHtmlExport( 37 | std::vector>& coverageArguments, 38 | const boost::filesystem::path& outputFolder); 39 | 40 | std::pair BuildExportTypeString( 41 | const std::string& exportType, 42 | const boost::filesystem::path& output); 43 | 44 | int RunCoverageFor( 45 | const std::vector>& coverageArguments, 46 | const boost::filesystem::path& programToRun, 47 | const std::vector& arguments); 48 | 49 | std::string GetSolutionFolderName(); 50 | } -------------------------------------------------------------------------------- /OpenCppCoverageTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /OpenCppCoverageTest/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /PropertySheets/Boost.64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | $(ExecutablePath) 7 | 8 | 9 | 10 | $(BOOST_FOLDER);%(AdditionalIncludeDirectories) 11 | BOOST_ALL_DYN_LINK;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 12 | 13 | 14 | $(BOOST_FOLDER)/stage/lib/x64;%(AdditionalLibraryDirectories) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PropertySheets/Boost.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | $(ExecutablePath) 7 | 8 | 9 | 10 | $(BOOST_FOLDER);%(AdditionalIncludeDirectories) 11 | BOOST_ALL_DYN_LINK;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 12 | 13 | 14 | $(BOOST_FOLDER)/stage/lib/x86;%(AdditionalLibraryDirectories) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PropertySheets/CTemplate.Debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(CTEMPLATE_ROOT)/Debug;%(AdditionalLibraryDirectories) 9 | libctemplate-debug.lib;template_test_util_test.lib;%(AdditionalDependencies) 10 | 11 | 12 | $(CTEMPLATE_ROOT)/src/windows;$(CTEMPLATE_ROOT)/src;%(AdditionalIncludeDirectories) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/CTemplate.Debug.x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(CTEMPLATE_ROOT)\x64\Debug;%(AdditionalLibraryDirectories) 9 | libctemplate-debug.lib;template_test_util_test.lib;%(AdditionalDependencies) 10 | 11 | 12 | $(CTEMPLATE_ROOT)/src/windows;$(CTEMPLATE_ROOT)/src;%(AdditionalIncludeDirectories) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/CTemplate.Release.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(CTEMPLATE_ROOT)/src/windows;$(CTEMPLATE_ROOT)/src;%(AdditionalIncludeDirectories) 9 | 10 | 11 | $(CTEMPLATE_ROOT)/Release;%(AdditionalLibraryDirectories) 12 | libctemplate.lib;template_test_util_test.lib;%(AdditionalDependencies) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/CTemplate.Release.x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(CTEMPLATE_ROOT)/src/windows;$(CTEMPLATE_ROOT)/src;%(AdditionalIncludeDirectories) 9 | 10 | 11 | $(CTEMPLATE_ROOT)/x64/Release;%(AdditionalLibraryDirectories) 12 | libctemplate.lib;template_test_util_test.lib;%(AdditionalDependencies) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/Default.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(SolutionDir);$(ProjectDir);%(AdditionalIncludeDirectories) 9 | OPENCPPCOVERAGE_VERSION="0.9.6";_CRT_SECURE_NO_WARNINGS;PROJECT_DIR=R"|($(ProjectDir))|";SOLUTION_DIR=R"|($(SolutionDir))|";TARGET_FILE_NAME=R"|($(TargetFileName))|";OUT_DIR=R"|($(OutDir))|";NOMINMAX;%(PreprocessorDefinitions) 10 | true 11 | true 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PropertySheets/GMock.Debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(GMOCK_ROOT)/include;$(GMOCK_ROOT)/gtest/include;%(AdditionalIncludeDirectories) 9 | 10 | 11 | $(GMOCK_ROOT)/build/Debug;%(AdditionalLibraryDirectories) 12 | gmock.lib;%(AdditionalDependencies) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/GMock.Debug.x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(GMOCK_ROOT)/include;$(GMOCK_ROOT)/gtest/include;%(AdditionalIncludeDirectories) 9 | 10 | 11 | $(GMOCK_ROOT)/build/x64/Debug;%(AdditionalLibraryDirectories) 12 | gmock.lib;%(AdditionalDependencies) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/GMock.Release.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(GMOCK_ROOT)/include;$(GMOCK_ROOT)/gtest/include;%(AdditionalIncludeDirectories) 9 | 10 | 11 | $(GMOCK_ROOT)/build/Release;%(AdditionalLibraryDirectories) 12 | gmock.lib;%(AdditionalDependencies) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/GMock.Release.x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(GMOCK_ROOT)/include;$(GMOCK_ROOT)/gtest/include;%(AdditionalIncludeDirectories) 9 | 10 | 11 | $(GMOCK_ROOT)/build/x64/Release;%(AdditionalLibraryDirectories) 12 | gmock.lib;%(AdditionalDependencies) 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /PropertySheets/Poco.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(POCO_ROOT)/lib;%(AdditionalLibraryDirectories) 9 | 10 | 11 | $(POCO_ROOT)/Foundation/include;%(AdditionalIncludeDirectories) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PropertySheets/Poco.x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | $(POCO_ROOT)/lib64;%(AdditionalLibraryDirectories) 9 | 10 | 11 | $(POCO_ROOT)/Foundation/include;%(AdditionalIncludeDirectories) 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /PropertySheets/ProtoBuff.Debug.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <_PropertySheetDisplayName>ProtoBuff.Debug 7 | 8 | 9 | 10 | $(PROTOBUFF_FOLDER)/src;%(AdditionalIncludeDirectories) 11 | 12 | 13 | $(PROTOBUFF_FOLDER)\vsprojects\Debug;%(AdditionalLibraryDirectories) 14 | libprotobuf.lib;%(AdditionalDependencies) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PropertySheets/ProtoBuff.Debug.x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <_PropertySheetDisplayName>ProtoBuff.Debug.x64 7 | 8 | 9 | 10 | $(PROTOBUFF_FOLDER)/src;%(AdditionalIncludeDirectories) 11 | 12 | 13 | $(PROTOBUFF_FOLDER)\vsprojects\x64\Debug;%(AdditionalLibraryDirectories) 14 | libprotobuf.lib;%(AdditionalDependencies) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PropertySheets/ProtoBuff.Release.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <_PropertySheetDisplayName>ProtoBuff.Release 7 | 8 | 9 | 10 | $(PROTOBUFF_FOLDER)/src;%(AdditionalIncludeDirectories) 11 | 12 | 13 | $(PROTOBUFF_FOLDER)\vsprojects\Release;%(AdditionalLibraryDirectories) 14 | libprotobuf.lib;%(AdditionalDependencies) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /PropertySheets/ProtoBuff.Release.x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <_PropertySheetDisplayName>ProtoBuff.Release.x64 7 | 8 | 9 | 10 | $(PROTOBUFF_FOLDER)/src;%(AdditionalIncludeDirectories) 11 | 12 | 13 | $(PROTOBUFF_FOLDER)\vsprojects\x64\Release;%(AdditionalLibraryDirectories) 14 | libprotobuf.lib;%(AdditionalDependencies) 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /TestCoverageConsole/FileWithSpecialCharéàè.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace TestCoverageConsole 22 | { 23 | //------------------------------------------------------------------------- 24 | inline boost::filesystem::path GetFileWithSpecialChars() 25 | { 26 | return boost::filesystem::path(__FILE__).filename(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /TestCoverageConsole/SpecialLineInfo.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "SpecialLineInfo.hpp" 18 | #include 19 | 20 | namespace TestCoverageConsole 21 | { 22 | //------------------------------------------------------------------------- 23 | void SpecialLineInfo() 24 | { 25 | // Generate a SRCCODEINFO::LineNumber == 0x00feefee 26 | try 27 | { 28 | throw 42; 29 | } 30 | catch (...) 31 | { 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /TestCoverageConsole/SpecialLineInfo.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace TestCoverageConsole 22 | { 23 | void SpecialLineInfo(); 24 | 25 | //------------------------------------------------------------------------- 26 | inline boost::filesystem::path GetSpecialLineInfoFilename() 27 | { 28 | return boost::filesystem::path(__FILE__).replace_extension("cpp").filename(); 29 | } 30 | } -------------------------------------------------------------------------------- /TestCoverageConsole/TestBasic.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | namespace TestCoverageConsole 23 | { 24 | void RunTestBasic(); 25 | void RunChildProcesses(int argc, _TCHAR* argv[]); 26 | void UnloadReloadDll(); 27 | 28 | //------------------------------------------------------------------------- 29 | inline int GetTestBasicLine() 30 | { 31 | return 32; 32 | } 33 | 34 | //------------------------------------------------------------------------- 35 | inline boost::filesystem::path GetTestBasicFilename() 36 | { 37 | return boost::filesystem::path(__FILE__).replace_extension("cpp").filename(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /TestCoverageConsole/TestCoverageConsole.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Unity-Technologies/OpenCppCoverage/4ae21f3f0bce5a6b305f584b3ef9d9c2cd7c5545/TestCoverageConsole/TestCoverageConsole.cpp -------------------------------------------------------------------------------- /TestCoverageConsole/TestDiff.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2017 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "TestDiff.hpp" 18 | 19 | namespace TestCoverageConsole 20 | { 21 | //----------------------------------------------------------------------------- 22 | void FilterByDiff() 23 | { 24 | int value1 = 0; 25 | if (true) // In Diff 26 | int value2 = 0; // In Diff 27 | if (false) // In Diff 28 | int value3 = 0; // In Diff 29 | int value4 = 0; 30 | } 31 | } -------------------------------------------------------------------------------- /TestCoverageConsole/TestDiff.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2017 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace TestCoverageConsole 22 | { 23 | void FilterByDiff(); 24 | 25 | //------------------------------------------------------------------------- 26 | inline boost::filesystem::path GetTestDiffFilename() 27 | { 28 | return boost::filesystem::path(__FILE__).replace_extension("cpp").filename(); 29 | } 30 | } -------------------------------------------------------------------------------- /TestCoverageConsole/TestThread.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "TestThread.hpp" 20 | 21 | #include 22 | 23 | namespace TestCoverageConsole 24 | { 25 | //----------------------------------------------------------------------------- 26 | void RunThread() 27 | { 28 | std::thread t([]() 29 | { 30 | int answer = 42; 31 | }); 32 | t.join(); 33 | } 34 | } -------------------------------------------------------------------------------- /TestCoverageConsole/TestThread.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace TestCoverageConsole 22 | { 23 | void RunThread(); 24 | 25 | //------------------------------------------------------------------------- 26 | inline boost::filesystem::path GetTestThreadFilename() 27 | { 28 | return boost::filesystem::path(__FILE__).replace_extension("cpp").filename(); 29 | } 30 | } -------------------------------------------------------------------------------- /TestCoverageOptimizedBuild/TestCoverageOptimizedBuild.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2017 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include 18 | 19 | namespace TestCoverageOptimizedBuild 20 | { 21 | __declspec(dllexport) boost::filesystem::path GetMainCppPath(); 22 | __declspec(dllexport) boost::filesystem::path GetOutputBinaryPath(); 23 | __declspec(dllexport) void TestOptimizedBuild(); 24 | } 25 | -------------------------------------------------------------------------------- /TestCoverageSharedLib/TestCoverageSharedLib.cpp: -------------------------------------------------------------------------------- 1 | // DllForCppCoverageTest.cpp : Defines the entry point for the application. 2 | // 3 | 4 | // OpenCppCoverage is an open source code coverage for C++. 5 | // Copyright (C) 2014 OpenCppCoverage 6 | // 7 | // This program is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU General Public License as published by 9 | // the Free Software Foundation, either version 3 of the License, or 10 | // any later version. 11 | // 12 | // This program is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU General Public License 18 | // along with this program. If not, see . 19 | 20 | #include "stdafx.h" 21 | #include "TestCoverageSharedLib.hpp" 22 | 23 | #include 24 | 25 | namespace fs = boost::filesystem; 26 | 27 | namespace TestCoverageSharedLib 28 | { 29 | //------------------------------------------------------------------------- 30 | bool IsOdd(int n) 31 | { 32 | if (n % 2 == 0) 33 | return true; 34 | 35 | return false; 36 | } 37 | 38 | //------------------------------------------------------------------------- 39 | fs::path GetMainCppPath() 40 | { 41 | return __FILE__ ; 42 | } 43 | 44 | //------------------------------------------------------------------------- 45 | fs::path GetOutputBinaryPath() 46 | { 47 | return boost::filesystem::path(OUT_DIR) / TARGET_FILE_NAME; 48 | } 49 | 50 | //------------------------------------------------------------------------- 51 | void CallSharedFunctionFromSharedLib() 52 | { 53 | SharedFunction(true); 54 | } 55 | } -------------------------------------------------------------------------------- /TestCoverageSharedLib/TestCoverageSharedLib.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | namespace TestCoverageSharedLib 22 | { 23 | __declspec(dllexport) boost::filesystem::path GetMainCppPath(); 24 | __declspec(dllexport) boost::filesystem::path GetOutputBinaryPath(); 25 | __declspec(dllexport) bool IsOdd(int n); 26 | 27 | __declspec(dllexport) void CallSharedFunctionFromSharedLib(); 28 | 29 | //------------------------------------------------------------------------- 30 | inline boost::filesystem::path GetSharedFunctionFilename() 31 | { 32 | return boost::filesystem::path(__FILE__).filename(); 33 | } 34 | 35 | //------------------------------------------------------------------------- 36 | inline int GetSharedFunctionLine() 37 | { 38 | return __LINE__ + 4; 39 | } 40 | 41 | //------------------------------------------------------------------------- 42 | inline bool SharedFunction(bool calledFromSharedLib) 43 | { 44 | if (calledFromSharedLib) 45 | return true; 46 | return false; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /TestCoverageSharedLib/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /TestCoverageSharedLib/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 20 | // Windows Header Files: 21 | #include 22 | 23 | -------------------------------------------------------------------------------- /TestHelper/Container.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | namespace TestHelper 20 | { 21 | template 22 | void AssertContainerEqual( 23 | const Container& container1, 24 | const Container& container2, 25 | const CompareFct& compareFct); 26 | 27 | template 28 | void AssertContainerUniquePtrEqual( 29 | const Container& container1, 30 | const Container& container2, 31 | const CompareFct& compareFct); 32 | 33 | template 34 | bool IsFirstContainsSecond( 35 | const Container& container1, 36 | const Container& container2, 37 | const std::function& getKeyFct, 38 | const CompareFct& compareFct); 39 | } 40 | 41 | #include "Container.inl" -------------------------------------------------------------------------------- /TestHelper/CoverageDataComparer.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "TestHelperExport.hpp" 20 | #include 21 | 22 | namespace CppCoverage 23 | { 24 | class CoverageData; 25 | class ModuleCoverage; 26 | } 27 | 28 | namespace TestHelper 29 | { 30 | class TEST_HELPER_DLL CoverageDataComparer 31 | { 32 | public: 33 | CoverageDataComparer() = default; 34 | 35 | void AssertEquals(const CppCoverage::CoverageData&, const CppCoverage::CoverageData&) const; 36 | void AssertEquals(const CppCoverage::ModuleCoverage*, const CppCoverage::ModuleCoverage*) const; 37 | 38 | using ModuleCoveragePtr = std::unique_ptr; 39 | using ModuleCoverageCollection = std::vector; 40 | 41 | bool IsFirstModuleContainsSecond( 42 | const ModuleCoveragePtr& module1, 43 | const ModuleCoveragePtr& module2) const; 44 | 45 | bool IsFirstCollectionContainsSecond( 46 | const ModuleCoverageCollection& container1, 47 | const ModuleCoverageCollection& container2) const; 48 | private: 49 | CoverageDataComparer(const CoverageDataComparer&) = delete; 50 | CoverageDataComparer& operator=(const CoverageDataComparer&) = delete; 51 | }; 52 | } -------------------------------------------------------------------------------- /TestHelper/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : TestHelper Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this TestHelper application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your TestHelper application. 9 | 10 | 11 | TestHelper.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | TestHelper.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | TestHelper.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named TestHelper.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /TestHelper/TemporaryPath.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "TestHelperExport.hpp" 22 | 23 | namespace TestHelper 24 | { 25 | enum class TemporaryPathOption 26 | { 27 | DoNotCreate, 28 | CreateAsFile, 29 | CreateAsFolder 30 | }; 31 | 32 | class TEST_HELPER_DLL TemporaryPath 33 | { 34 | public: 35 | 36 | explicit TemporaryPath(TemporaryPathOption = TemporaryPathOption::DoNotCreate); 37 | ~TemporaryPath(); 38 | 39 | operator const boost::filesystem::path& () const; 40 | const boost::filesystem::path& GetPath() const; 41 | 42 | private: 43 | TemporaryPath(const TemporaryPath&) = delete; 44 | TemporaryPath& operator=(const TemporaryPath&) = delete; 45 | 46 | private: 47 | boost::filesystem::path path_; 48 | }; 49 | } -------------------------------------------------------------------------------- /TestHelper/TestHelperExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #ifdef TEST_HELPER_EXPORTS 20 | #define TEST_HELPER_DLL __declspec(dllexport) 21 | #else 22 | #define TEST_HELPER_DLL _declspec(dllimport) 23 | #endif 24 | 25 | #pragma warning (disable: 4251) 26 | -------------------------------------------------------------------------------- /TestHelper/Tools.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "stdafx.h" 20 | #include "Tools.hpp" 21 | #include 22 | #include 23 | 24 | //------------------------------------------------------------------------- 25 | void TestUnloadDll() 26 | { 27 | } 28 | 29 | namespace TestHelper 30 | { 31 | //------------------------------------------------------------------------- 32 | boost::filesystem::path GetTestUnloadDllFilename() 33 | { 34 | return boost::filesystem::path(__FILE__).filename(); 35 | } 36 | 37 | //------------------------------------------------------------------------- 38 | boost::filesystem::path GetOutputBinaryPath() 39 | { 40 | return TARGET_FILE_NAME; 41 | } 42 | 43 | //------------------------------------------------------------------------- 44 | void CreateEmptyFile(const boost::filesystem::path& path) 45 | { 46 | std::ofstream ofs; 47 | ofs.open(path.string(), std::ios::out); 48 | } 49 | } -------------------------------------------------------------------------------- /TestHelper/Tools.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "TestHelperExport.hpp" 20 | 21 | namespace boost 22 | { 23 | namespace filesystem 24 | { 25 | class path; 26 | } 27 | } 28 | 29 | extern "C" 30 | { 31 | void TEST_HELPER_DLL TestUnloadDll(); 32 | } 33 | 34 | namespace TestHelper 35 | { 36 | boost::filesystem::path TEST_HELPER_DLL GetTestUnloadDllFilename(); 37 | boost::filesystem::path TEST_HELPER_DLL GetOutputBinaryPath(); 38 | 39 | void TEST_HELPER_DLL CreateEmptyFile(const boost::filesystem::path&); 40 | } 41 | -------------------------------------------------------------------------------- /TestHelper/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | 19 | // TODO: reference any additional headers you need in STDAFX.H 20 | // and not in this file 21 | -------------------------------------------------------------------------------- /TestHelper/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /Tools/DbgHelp.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #pragma warning(push) 20 | #pragma warning(disable: 4091) // 'typedef ': ignored on left of '' when no variable is declared 21 | #include 22 | #pragma warning(pop) 23 | -------------------------------------------------------------------------------- /Tools/MappedFile.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2017 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #include "ToolsExport.hpp" 25 | 26 | namespace Tools 27 | { 28 | class TOOLS_DLL MappedFile 29 | { 30 | public: 31 | static std::unique_ptr TryCreate(const boost::filesystem::path&); 32 | 33 | const std::vector& GetLines() const; 34 | 35 | MappedFile(const MappedFile&) = delete; 36 | MappedFile& operator=(const MappedFile&) = delete; 37 | MappedFile(MappedFile&&) = default; 38 | 39 | private: 40 | explicit MappedFile(const boost::filesystem::path&); 41 | 42 | std::vector lines_; 43 | }; 44 | } -------------------------------------------------------------------------------- /Tools/Tool.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #include "ToolsExport.hpp" 26 | 27 | namespace Tools 28 | { 29 | TOOLS_DLL std::wstring LocalToWString(const std::string&); 30 | TOOLS_DLL std::wstring Utf8ToWString(const std::string&); 31 | TOOLS_DLL std::string ToLocalString(const std::wstring&); 32 | TOOLS_DLL std::string ToUtf8String(const std::wstring&); 33 | 34 | TOOLS_DLL boost::optional Try(std::function); 35 | TOOLS_DLL boost::filesystem::path GetTemplateFolder(); 36 | 37 | TOOLS_DLL void CreateMiniDumpOnUnHandledException(); 38 | 39 | TOOLS_DLL void ShowOutputMessage(const std::wstring& message, const boost::filesystem::path& path); 40 | TOOLS_DLL std::wstring GetSeparatorLine(); 41 | 42 | TOOLS_DLL void CreateParentFolderIfNeeded(const boost::filesystem::path& path); 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /Tools/ToolsExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#ifdef TOOLS_EXPORTS 20 | //#define TOOLS_DLL __declspec(dllexport) 21 | //#else 22 | //#define TOOLS_DLL _declspec(dllimport) 23 | //#endif 24 | #define TOOLS_DLL 25 | 26 | #pragma warning (disable: 4251) 27 | -------------------------------------------------------------------------------- /Tools/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // dllmain.cpp : Defines the entry point for the DLL application. 2 | // OpenCppCoverage is an open source code coverage for C++. 3 | // Copyright (C) 2014 OpenCppCoverage 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU General Public License 16 | // along with this program. If not, see . 17 | 18 | #include "stdafx.h" 19 | 20 | BOOL APIENTRY DllMain( HMODULE hModule, 21 | DWORD ul_reason_for_call, 22 | LPVOID lpReserved 23 | ) 24 | { 25 | switch (ul_reason_for_call) 26 | { 27 | case DLL_PROCESS_ATTACH: 28 | case DLL_THREAD_ATTACH: 29 | case DLL_THREAD_DETACH: 30 | case DLL_PROCESS_DETACH: 31 | break; 32 | } 33 | return TRUE; 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Tools/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | -------------------------------------------------------------------------------- /Tools/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 20 | // Windows Header Files: 21 | #include 22 | -------------------------------------------------------------------------------- /ToolsCross/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | set(CMAKE_CXX_STANDARD 14) 3 | 4 | include_directories(${CMAKE_SOURCE_DIR}) 5 | 6 | add_library(ToolsCross 7 | ExceptionBase.cpp 8 | ExceptionBase.hpp 9 | Log.hpp 10 | Log.cpp 11 | ScopedAction.hpp 12 | ScopedAction.cpp 13 | ToolsException.hpp 14 | ToolsExport.hpp 15 | UniquePath.hpp 16 | UniquePath.cpp) 17 | 18 | link_directories(${CMAKE_SOURCE_DIR}) -------------------------------------------------------------------------------- /ToolsCross/ExceptionBase.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "ExceptionBase.hpp" 18 | #ifdef _WIN32 19 | #include 20 | #elif __linux__ 21 | #include 22 | #endif 23 | 24 | namespace Tools 25 | { 26 | //------------------------------------------------------------------------- 27 | ExceptionBase::ExceptionBase(const std::wstring& message) 28 | : std::runtime_error(ToLocalString(message).c_str()) 29 | { 30 | } 31 | } -------------------------------------------------------------------------------- /ToolsCross/ScopedAction.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "ScopedAction.hpp" 18 | 19 | #include 20 | 21 | #ifdef _WIN32 22 | #include 23 | #elif __linux__ 24 | #include 25 | #endif 26 | #include "Log.hpp" 27 | 28 | namespace Tools 29 | { 30 | //------------------------------------------------------------------------- 31 | ScopedAction::ScopedAction(std::function action) 32 | : action_(action) 33 | { 34 | } 35 | 36 | //------------------------------------------------------------------------- 37 | ScopedAction::~ScopedAction() 38 | { 39 | auto error = Try([&] 40 | { 41 | action_(); 42 | }); 43 | 44 | if (error) 45 | LOG_ERROR << *error; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /ToolsCross/ScopedAction.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | 21 | #include "ToolsExport.hpp" 22 | 23 | namespace Tools 24 | { 25 | class TOOLS_DLL ScopedAction 26 | { 27 | public: 28 | explicit ScopedAction(std::function); 29 | ~ScopedAction(); 30 | 31 | private: 32 | ScopedAction(const ScopedAction&) = delete; 33 | ScopedAction& operator=(const ScopedAction&) = delete; 34 | 35 | private: 36 | std::function action_; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /ToolsCross/ToolsException.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "ExceptionBase.hpp" 20 | 21 | GENERATE_EXCEPTION_CLASS(Tools, ToolsException); 22 | 23 | #define THROW(message) THROW_BASE(Tools, ToolsException, message) 24 | 25 | -------------------------------------------------------------------------------- /ToolsCross/ToolsExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | //#ifdef TOOLS_EXPORTS 20 | //#define TOOLS_DLL __declspec(dllexport) 21 | //#else 22 | //#define TOOLS_DLL _declspec(dllimport) 23 | #define TOOLS_DLL 24 | //#endif 25 | 26 | #pragma warning (disable: 4251) 27 | -------------------------------------------------------------------------------- /ToolsCross/UniquePath.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "UniquePath.hpp" 18 | 19 | #include 20 | 21 | namespace Tools 22 | { 23 | //------------------------------------------------------------------------- 24 | boost::filesystem::path UniquePath::GetUniquePath(const boost::filesystem::path& path) 25 | { 26 | auto uniquePath = path; 27 | auto filenameWithoutExtension = path.filename().replace_extension(L""); 28 | 29 | for (int i = 2; existingPathSet_.count(uniquePath) != 0; ++i) 30 | { 31 | auto filename = filenameWithoutExtension.wstring() + std::to_wstring(i) + path.extension().wstring(); 32 | uniquePath = path.parent_path() / filename; 33 | } 34 | existingPathSet_.insert(uniquePath); 35 | return uniquePath; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ToolsCross/UniquePath.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include "ToolsExport.hpp" 20 | 21 | #include 22 | 23 | namespace boost 24 | { 25 | namespace filesystem 26 | { 27 | class path; 28 | } 29 | } 30 | 31 | namespace Tools 32 | { 33 | class TOOLS_DLL UniquePath 34 | { 35 | public: 36 | UniquePath() = default; 37 | 38 | UniquePath(const UniquePath&) = delete; 39 | UniquePath& operator=(const UniquePath&) = delete; 40 | UniquePath(UniquePath&&) = delete; 41 | UniquePath& operator=(UniquePath&&) = delete; 42 | 43 | // GetUniquePath returns "path" if there was no previous 44 | // call to GetUniquePath with this value else it returns an unique 45 | // path starting with "path". 46 | boost::filesystem::path GetUniquePath(const boost::filesystem::path& path); 47 | 48 | private: 49 | std::set existingPathSet_; 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /ToolsLinux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.12) 2 | set(CMAKE_CXX_STANDARD 14) 3 | 4 | add_library(ToolsLinux 5 | Tool.hpp 6 | Tool.cpp 7 | ToolsExport.hpp) 8 | 9 | 10 | include_directories(${PROJECT_SOURCE_DIR}) -------------------------------------------------------------------------------- /ToolsLinux/Tool.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | #include 24 | 25 | #include "ToolsExport.hpp" 26 | #include 27 | 28 | namespace Tools 29 | { 30 | TOOLS_DLL std::wstring LocalToWString(const std::string&); 31 | TOOLS_DLL std::wstring Utf8ToWString(const std::string&); 32 | TOOLS_DLL std::string ToLocalString(const std::wstring&); 33 | TOOLS_DLL std::string ToUtf8String(const std::wstring&); 34 | 35 | TOOLS_DLL boost::optional Try(std::function); 36 | TOOLS_DLL boost::filesystem::path GetTemplateFolder(); 37 | 38 | TOOLS_DLL void CreateMiniDumpOnUnHandledException(); 39 | 40 | TOOLS_DLL void ShowOutputMessage(const std::wstring& message, const boost::filesystem::path& path); 41 | TOOLS_DLL std::wstring GetSeparatorLine(); 42 | 43 | TOOLS_DLL void CreateParentFolderIfNeeded(const boost::filesystem::path& path); 44 | } 45 | -------------------------------------------------------------------------------- /ToolsLinux/ToolsExport.hpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2014 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #define TOOLS_DLL 20 | 21 | #pragma warning (disable: 4251) 22 | -------------------------------------------------------------------------------- /ToolsTest/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | CONSOLE APPLICATION : ToolsTest Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this ToolsTest application for you. 6 | 7 | This file contains a summary of what you will find in each of the files that 8 | make up your ToolsTest application. 9 | 10 | 11 | ToolsTest.vcxproj 12 | This is the main project file for VC++ projects generated using an Application Wizard. 13 | It contains information about the version of Visual C++ that generated the file, and 14 | information about the platforms, configurations, and project features selected with the 15 | Application Wizard. 16 | 17 | ToolsTest.vcxproj.filters 18 | This is the filters file for VC++ projects generated using an Application Wizard. 19 | It contains information about the association between the files in your project 20 | and the filters. This association is used in the IDE to show grouping of files with 21 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 22 | "Source Files" filter). 23 | 24 | ToolsTest.cpp 25 | This is the main application source file. 26 | 27 | ///////////////////////////////////////////////////////////////////////////// 28 | Other standard files: 29 | 30 | StdAfx.h, StdAfx.cpp 31 | These files are used to build a precompiled header (PCH) file 32 | named ToolsTest.pch and a precompiled types file named StdAfx.obj. 33 | 34 | ///////////////////////////////////////////////////////////////////////////// 35 | Other notes: 36 | 37 | AppWizard uses "TODO:" comments to indicate parts of the source code you 38 | should add to or customize. 39 | 40 | ///////////////////////////////////////////////////////////////////////////// 41 | -------------------------------------------------------------------------------- /ToolsTest/ToolTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include "ToolsCross/Tool.hpp" 19 | 20 | namespace ToolsTests 21 | { 22 | //--------------------------------------------------------------------- 23 | TEST(Tool, ToLocalString) 24 | { 25 | ASSERT_EQ("", Tools::ToLocalString(L"")); 26 | ASSERT_EQ("123456789", Tools::ToLocalString(L"123456789")); 27 | ASSERT_EQ(1, Tools::ToLocalString(L"1").size()); 28 | ASSERT_EQ(std::string("���"), Tools::ToLocalString(L"���")); 29 | } 30 | 31 | //--------------------------------------------------------------------- 32 | TEST(Tool, LocalToWString) 33 | { 34 | ASSERT_EQ(L"", Tools::LocalToWString("")); 35 | ASSERT_EQ(L"123456789", Tools::LocalToWString("123456789")); 36 | ASSERT_EQ(1, Tools::LocalToWString("1").size()); 37 | ASSERT_EQ(std::wstring(L"���"), Tools::LocalToWString("���")); 38 | } 39 | 40 | //--------------------------------------------------------------------- 41 | TEST(Tool, Uft8) 42 | { 43 | ASSERT_EQ(L"���", Tools::Utf8ToWString(Tools::ToUtf8String(L"���"))); 44 | } 45 | } -------------------------------------------------------------------------------- /ToolsTest/ToolsTest.cpp: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #include "stdafx.h" 18 | #include 19 | 20 | //----------------------------------------------------------------------------- 21 | int _tmain(int argc, _TCHAR* argv[]) 22 | { 23 | ::testing::InitGoogleMock(&argc, argv); 24 | return RUN_ALL_TESTS(); 25 | } -------------------------------------------------------------------------------- /ToolsTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // ToolsTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /ToolsTest/stdafx.h: -------------------------------------------------------------------------------- 1 | // OpenCppCoverage is an open source code coverage for C++. 2 | // Copyright (C) 2016 OpenCppCoverage 3 | // 4 | // This program is free software: you can redistribute it and/or modify 5 | // it under the terms of the GNU General Public License as published by 6 | // the Free Software Foundation, either version 3 of the License, or 7 | // any later version. 8 | // 9 | // This program is distributed in the hope that it will be useful, 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | // GNU General Public License for more details. 13 | // 14 | // You should have received a copy of the GNU General Public License 15 | // along with this program. If not, see . 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | -------------------------------------------------------------------------------- /UnitTests.testsettings: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | This test run configuration is used for running the unit tests 9 | 10 | --------------------------------------------------------------------------------