本文整理汇总了C++中MockRepository::ExpectCall方法的典型用法代码示例。如果您正苦于以下问题:C++ MockRepository::ExpectCall方法的具体用法?C++ MockRepository::ExpectCall怎么用?C++ MockRepository::ExpectCall使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MockRepository
的用法示例。
在下文中一共展示了MockRepository::ExpectCall方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vmxon
void
vmxon_ut::test_stop_vmxoff_check_failure()
{
MockRepository mocks;
auto in = bfn::mock_shared<intrinsics_intel_x64>(mocks);
auto intrinsics = in.get();
auto l_mm = bfn::mock_shared<memory_manager>(mocks);
mm = l_mm.get();
// execute_vmxoff
mocks.OnCall(intrinsics, intrinsics_intel_x64::vmxoff).Return(true);
// disable_vmx_operation
Call &cr4_0 = mocks.ExpectCall(intrinsics, intrinsics_intel_x64::read_cr4).Return(0);
mocks.OnCall(intrinsics, intrinsics_intel_x64::write_cr4).Do(stubbed_write_cr4);
// is_vmx_operation_enabled
mocks.ExpectCall(intrinsics, intrinsics_intel_x64::read_cr4).After(cr4_0).Return(CR4_VMXE_VMX_ENABLE_BIT);
RUN_UNITTEST_WITH_MOCKS(mocks, [&]
{
vmxon_intel_x64 vmxon(in);
EXPECT_EXCEPTION(vmxon.stop(), bfn::vmxon_failure_error);
});
}
示例2: oSyncEngine
TEST(SyncEngine, syncAllSourcesOK)
{
MockRepository mocks;
CSyncSource* src0 = mocks.ClassMock<CSyncSource>();
mocks.ExpectCall(src0, CSyncSource::isEmptyToken).Return(true);
mocks.ExpectCall(src0, CSyncSource::sync);
CDBAdapter db;
CSyncEngine oSyncEngine(db);
oSyncEngine.getSources().add(src0);
oSyncEngine.setLoggedIn(true);
oSyncEngine.syncAllSources();
mocks.removeMock(src0);
}
示例3: vmm
void
vmm_ut::test_disable_vmx_operation_success()
{
MockRepository mocks;
intrinsics_intel_x64 *intrinsics = mocks.Mock<intrinsics_intel_x64>();
vmm_intel_x64 vmm(intrinsics);
mocks.OnCall(intrinsics, intrinsics_intel_x64::read_cr4).Return(0xFFFFFFFFFFFFFFFF);
mocks.ExpectCall(intrinsics, intrinsics_intel_x64::write_cr4).With(~CR4_VMXE_VMX_ENABLE_BIT);
RUN_UNITTEST_WITH_MOCKS(mocks, [&]
{
EXPECT_TRUE(vmm.disable_vmx_operation() == vmm_error::success);
});
}