30 vcpu_ut::test_vcpu_manager_create_valid()
33 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
41 g_vcm->delete_vcpu(0);
48 vcpu_ut::test_vcpu_manager_create_valid_twice_overwrites()
51 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
60 g_vcm->delete_vcpu(0);
67 vcpu_ut::test_vcpu_manager_create_make_vcpu_returns_null()
73 vcpu_ut::test_vcpu_manager_create_make_vcpu_throws()
81 vcpu_ut::test_vcpu_manager_create_init_throws()
84 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
86 mocks.OnCall(g_vcpu,
vcpu::init).Throw(std::runtime_error(
"error"));
92 g_vcm->delete_vcpu(0);
99 vcpu_ut::test_vcpu_manager_delete_valid()
101 MockRepository mocks;
102 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
109 g_vcm->create_vcpu(0);
117 vcpu_ut::test_vcpu_manager_delete_valid_twice()
119 MockRepository mocks;
120 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
127 g_vcm->create_vcpu(0);
136 vcpu_ut::test_vcpu_manager_delete_no_create()
138 MockRepository mocks;
139 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
153 vcpu_ut::test_vcpu_manager_delete_fini_throws()
155 MockRepository mocks;
156 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
159 mocks.OnCall(g_vcpu,
vcpu::fini).Throw(std::runtime_error(
"error"));
163 g_vcm->create_vcpu(0);
171 vcpu_ut::test_vcpu_manager_run_valid()
173 MockRepository mocks;
174 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
184 g_vcm->create_vcpu(0);
186 g_vcm->delete_vcpu(0);
193 vcpu_ut::test_vcpu_manager_run_valid_twice()
195 MockRepository mocks;
196 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
206 g_vcm->create_vcpu(0);
209 g_vcm->delete_vcpu(0);
216 vcpu_ut::test_vcpu_manager_run_run_throws()
218 MockRepository mocks;
219 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
223 mocks.OnCall(g_vcpu,
vcpu::run).Throw(std::runtime_error(
"error"));
229 g_vcm->create_vcpu(0);
231 g_vcm->delete_vcpu(0);
238 vcpu_ut::test_vcpu_manager_run_hlt_throws()
240 MockRepository mocks;
241 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
245 mocks.OnCall(g_vcpu,
vcpu::run).Throw(std::runtime_error(
"error"));
246 mocks.OnCall(g_vcpu,
vcpu::hlt).Throw(std::logic_error(
"error"));
251 g_vcm->create_vcpu(0);
253 g_vcm->delete_vcpu(0);
260 vcpu_ut::test_vcpu_manager_run_no_create()
262 MockRepository mocks;
263 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
280 vcpu_ut::test_vcpu_manager_hlt_valid()
282 MockRepository mocks;
283 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
293 g_vcm->create_vcpu(0);
299 g_vcm->delete_vcpu(0);
306 vcpu_ut::test_vcpu_manager_hlt_valid_twice()
308 MockRepository mocks;
309 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
319 g_vcm->create_vcpu(0);
326 g_vcm->delete_vcpu(0);
333 vcpu_ut::test_vcpu_manager_hlt_hlt_throws()
335 MockRepository mocks;
336 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
341 mocks.OnCall(g_vcpu,
vcpu::hlt).Throw(std::runtime_error(
"error"));
346 g_vcm->create_vcpu(0);
352 g_vcm->delete_vcpu(0);
359 vcpu_ut::test_vcpu_manager_hlt_no_create()
361 MockRepository mocks;
362 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
379 vcpu_ut::test_vcpu_manager_write_null()
381 MockRepository mocks;
382 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
390 g_vcm->create_vcpu(0);
392 g_vcm->delete_vcpu(0);
399 vcpu_ut::test_vcpu_manager_write_hello()
401 MockRepository mocks;
402 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
406 mocks.ExpectCall(g_vcpu,
vcpu::write).With(
"hello"_s);
410 g_vcm->create_vcpu(0);
411 g_vcm->write(0,
"hello");
412 g_vcm->delete_vcpu(0);
419 vcpu_ut::test_vcpu_manager_write_no_create()
421 MockRepository mocks;
422 g_vcpu = bfn::mock_no_delete<vcpu>(mocks);
430 g_vcm->write(0,
"hello");
#define expect_exception(f, e)
virtual bool is_running()
#define RUN_UNITTEST_WITH_MOCKS(a, b)
#define expect_no_exception(f)
virtual void run(user_data *data=nullptr)
virtual void init(user_data *data=nullptr)
virtual void hlt(user_data *data=nullptr)
virtual void write(const std::string &str) noexcept
virtual void fini(user_data *data=nullptr)