xasm_rs/
lib.rs

1pub mod genasm;
2pub mod init;
3pub mod mkwnasm;
4pub mod osconfig;
5
6#[cfg(test)]
7mod tests {
8    use crate::mkwnasm::compile_with_nasm;
9
10    use super::*;
11
12    #[test]
13    pub fn testxasm() {
14        let mut xasm = init::Xasm::new();
15        xasm.tokens.push(init::Tokens::print(
16            init::FileDescriptor::STDOUT,
17            "\"hello world\"".chars().collect(),
18        ));
19        xasm.tokens.push(init::Tokens::print(
20            init::FileDescriptor::STDERR,
21            "\"Hello Universe!\"".chars().collect(),
22        ));
23        let asm = genasm::genasm(&xasm, osconfig::OsConfig::Linux_X86_64);
24        println!("{}", asm);
25        match compile_with_nasm(&asm,osconfig::OsConfig::Linux_X86_64) {
26            Ok(()) => (),
27            Err(e) => panic!("compilation failed: {}", e),
28        }
29        // Optionally, add assertions here
30    }
31}