草庐IT

test_fold

全部标签

unit-testing - Jacoco 如何获得测试覆盖率或忽略 Kotlin 数据类

Jacoco显示Kotlin数据类的覆盖率为0%。如何配置它来测量覆盖率或完全忽略数据类? 最佳答案 我正在寻找针对数据模型类的自动生成代码的相同测试覆盖率问题的解决方案,但偶然发现了以下问题:Kotlin+JaCoCo:TuningCompilertoSkipGeneratedCode解决方案:将JaCoCo插件更新到0.8.2即可解决您的问题。JaCoCo在0.8.2版本中已经解决了这个问题,请阅读更新日志-使用运行时可见和不可见注释注释的类和方法,其简单名称为Generated在生成报告期间被过滤掉(GitHub#731)。K

c++ - 为什么 valgrind 没有在我的 "test"程序中检测到内存泄漏?

整个测试代码包含在main.cpp中如下:#includeusingstd::cout;usingstd::endl;voidf(inti){int*pi=newint;*pi=i;std::cout我编译时没有优化-O0(来自EclipseQt项目):g++-c-pipe-O0-Wall-W-D_REENTRANT-DQT_NO_DEBUG-DQT_GUI_LIB-DQT_CORE_LIB-DQT_SHARED-I/usr/share/qt4/mkspecs/linux-g++-I.-I/usr/include/qt4/QtCore-I/usr/include/qt4/QtGui-I

c++ - boost 测试不 init_unit_test_suite

我运行这段代码#defineBOOST_TEST_MAIN#defineBOOST_TEST_DYN_LINK#include#include#include#includeusingnamespaceboost::unit_test;usingnamespacestd;voidTestFoo(){BOOST_CHECK(0==0);}test_suite*init_unit_test_suite(intargc,char*argv[]){std::coutadd(BOOST_TEST_CASE(&TestFoo));returnmaster_test_suite;}但是在运行时它说T

c++ - "The C++ compiler "/usr/bin/c++ "is not able to compile a simple test program."尝试安装 OpenCV 时

我正尝试按照此link在我的Mac上安装OpenCV但是,当我在终端上键入cmake-G"UnixMakefiles"..时,会打印出此错误。--TheCXXcompileridentificationisunknown--TheCcompileridentificationisunknown--CheckforworkingCXXcompiler:/usr/bin/c++--CheckforworkingCXXcompiler:/usr/bin/c++--brokenCMakeErrorat/opt/local/share/cmake-3.0/Modules/CMakeTestCXX

c++ - BOOST_PP_SEQ_FOLD_LEFT 是如何工作的?

我需要编写一个宏来处理任意长的列表,例如(A)(B)(C)。如果我可以采用Boost依赖项,我将只使用BOOST_PP_SEQ_之一宏系列。不幸的是,我不能,所以我只能尝试弄清楚它是如何工作的。这东西并不明显。这里有人能写一个简单的、独立的实现吗,比方说,BOOST_PP_SEQ_FOLD_LEFT给我看看?特别是,我想转换:template_(classA,classB,classC)(requiresIsFoo&&IsBar)(requiresIsBaz)voidfrobozzle(A,B,C);重写为:template&&IsBar),int>=0,std::enable_if_

c++ - 不存在从 "test *"转换为 "test"的合适构造函数,构造函数,

我是c++的新手,我在构造函数和类方面遇到了困难。所以,这是我的头文件:#pragmaonce#includeusingnamespacestd;classtest{private:stringname;intnumber;public:test();test(stringi,intb);};这是cpp文件:#include"test.h"#includeusingnamespacestd;test::test(){}test::test(stringi,intb){this->name=i;this->number=b;}现在,当我尝试调用testt=newtest("rrr",8)

c++ - Google Test 找不到用户提供的相等运算符

我正在使用GoogleTestv1.7我创建了一个自定义的operator==,ASSERT_EQ找不到,但直接使用可以找到。这是代码#include#include#include"gtest/gtest.h"templatestructbar{Tb;};templatebooloperator==(conststd::vector&v,constbar&b){returnfalse;}templatebooloperator==(conststd::vector&v,conststd::deque&d){returnfalse;}TEST(A,B){std::vectorvec;s

c++ - 用 Boost::Test 模拟

我正在使用Boost::Test库进行单元测试,而且我一直在破解我自己的模拟解决方案,看起来像这样://InheaderforclientsstructRealFindFirstFile{staticHANDLEFindFirst(LPCWSTRlpFileName,LPWIN32_FIND_DATAWlpFindFileData){returnFindFirstFile(lpFileName,lpFindFileData);};};templateclassDirectoryIterator{//..Implementation}//Inunittests(cpp)#defineTH

c++ - 在 Windows 上使用 Google Test 时内存泄漏

当我运行以下代码时:#include"gmock/gmock.h"#include"gtest/gtest.h"#define_CRTDBG_MAP_ALLOC#includeintmain(intargc,char**argv){::testing::InitGoogleTest(&argc,argv);_CrtDumpMemoryLeaks();return0;}我得到以下输出:Detectedmemoryleaks!Dumpingobjects->{652}normalblockat0x00074CE0,4byteslong.Data:984C0700{651}normalblo

windows - CMake 内部错误 (TEST_BIG_ENDIAN)

我在Windows764位上使用CMake(尽管我在32位中编译)。我正在尝试安装vxl库,当我运行CMake(从界面)时,出现以下错误:TheCcompileridentificationisunknownTheCXXcompileridentificationisunknownCheckifthesystemisbigendianSearching16bitintegerCMakeErroratC:/ProgramFiles(x86)/CMake2.8/share/cmake-2.8/Modules/TestBigEndian.cmake:44(message):nosuitabl