Skip to content

Commit

Permalink
feat: test assert
Browse files Browse the repository at this point in the history
  • Loading branch information
yjl9903 committed Oct 6, 2023
1 parent 6bb752d commit 79c7280
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
11 changes: 11 additions & 0 deletions fixtures/aplusb/source/assert.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <cassert>
#include <iostream>

using namespace std;

int main() {
int a = 1, b = 1;
cin >> a >> b;
assert(a == 1 && b == 1);
return 0;
}
10 changes: 9 additions & 1 deletion tests/aplusb.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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));
}

0 comments on commit 79c7280

Please sign in to comment.