From 79c72806692e577cbf8d7725cfa681b02897e121 Mon Sep 17 00:00:00 2001 From: XLor Date: Fri, 6 Oct 2023 14:18:34 +0800 Subject: [PATCH] feat: test assert --- fixtures/aplusb/source/assert.cpp | 11 +++++++++++ tests/aplusb.rs | 10 +++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 fixtures/aplusb/source/assert.cpp diff --git a/fixtures/aplusb/source/assert.cpp b/fixtures/aplusb/source/assert.cpp new file mode 100644 index 0000000..14b3b8d --- /dev/null +++ b/fixtures/aplusb/source/assert.cpp @@ -0,0 +1,11 @@ +#include +#include + +using namespace std; + +int main() { + int a = 1, b = 1; + cin >> a >> b; + assert(a == 1 && b == 1); + return 0; +} diff --git a/tests/aplusb.rs b/tests/aplusb.rs index 38082bd..443dcf5 100644 --- a/tests/aplusb.rs +++ b/tests/aplusb.rs @@ -1,4 +1,4 @@ -use catj::{run, CatBoxBuilder, CatBoxResult, RestrictedSyscall}; +use catj::{run, CatBoxBuilder, CatBoxResult}; use log::info; use nix::sys::signal::Signal; use std::env::current_dir; @@ -247,3 +247,11 @@ fn it_should_not_run_re2() { assert_eq!(*result.status(), None); assert_eq!(*result.signal(), Some(Signal::SIGSEGV)); } + +#[test] +fn it_should_not_run_assert() { + common::setup(); + let result = run_fail_cpp("assert.cpp", 1000, 262144); + assert_eq!(*result.status(), None); + assert_eq!(*result.signal(), Some(Signal::SIGABRT)); +}