emjudge-judgecore 0.1.12

Emjudge-Judgecore is a comprehensive library designed for the evaluation and testing of executing programs against specific specifications. Offering a robust judging system, it provides the framework for running and assessing programs within defined criteria, making it an essential tool for comprehensive program evaluation and testing.
Documentation
use emjudge_judgecore::{
    quantity::{MemorySize, TimeSpan},
    settings::{create_a_tmp_user_return_uid, CompileAndExeSettings},
    {program::RawCode, test::OnlyRun},
};
use tokio::io::AsyncReadExt;

#[tokio::main(flavor = "current_thread")]
async fn main() {
    let compile_and_exe_settings = CompileAndExeSettings::load_from_file(
        "examples/compile_and_exe_settings.toml",
        config::FileFormat::Toml,
    )
    .unwrap();
    let code_uid = create_a_tmp_user_return_uid("emjudge-judgecore-code").unwrap();
    let mut script = vec![];
    tokio::fs::File::open("examples/programs/mle.cpp")
        .await
        .unwrap()
        .read_to_end(&mut script)
        .await
        .unwrap();
    let result = OnlyRun::single(
        &RawCode::new(
            &script,
            compile_and_exe_settings.get_language("C++").unwrap(),
        ),
        TimeSpan::from_seconds(1),
        MemorySize::from_megabytes(1),
        code_uid,
        &vec![],
        MemorySize::from_megabytes(1),
    )
    .await;
    println!("Result: {}", result);
}