草庐IT

hit-testing

全部标签

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++ - "The breakpoint will not currently be hit"- 我无法添加 .pdb 文件

我在VisualStudio2013(VisualC++)中有一个项目的解决方案。但是当我在debug模式下构建它,然后在debug模式下运行它时,我得到:Thebreakpointwillnotcurrentlybehit.Nosymbolshavebeenloadedforthisdocument.我试图以类比的方式修复它,类似于人们对VisualC#的建议Fixing"Thebreakpointwillnotcurrentlybehit.Nosymbolshavebeenloadedforthisdocument."不幸的是,都没有有效:清理和重建解决方案(也包含手动删除的临时文

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++ - 一个 "hits in last [second/minute/hour]"数据结构的实现

我认为这是一个相当普遍的问题,但我似乎无法通过谷歌搜索找到答案(也许我不知道的问题有更准确的名称?)您需要使用用于报告命中的“hit()”方法和hitsInLastSecond|Minute|Hour方法来实现一个结构。你有一个精确到纳秒级的计时器。您如何有效地实现这一点?我的想法是这样的(在伪C++中)classHitCounter{voidhit(){hits_at[now()]=++last_count;}inthitsInLastSecond(){autobefore_count=hits_at.lower_bound(now()-1*second)if(before_coun

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