-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
55f9e19
commit 778fdfd
Showing
2 changed files
with
178 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
extern crate c_compiler; | ||
|
||
use c_compiler::*; | ||
use serial_test::serial; | ||
|
||
static BASIC_SAMPLE: &str = "samples/basic.c"; | ||
static UNARY_SAMPLE: &str = "samples/unary.c"; | ||
static BINARY_SAMPLE: &str = "samples/binary.c"; | ||
static DIV_SAMPLE: &str = "samples/div.c"; | ||
|
||
// ------------ basic functions --------- | ||
// | ||
#[test] | ||
#[serial] | ||
fn basic_ir() { | ||
let driver = Driver::new(BASIC_SAMPLE); | ||
driver.compile(CompileStage::IR, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn basic_codegen() { | ||
let driver = Driver::new(BASIC_SAMPLE); | ||
driver.compile(CompileStage::Codegen, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn basic_full() { | ||
let driver = Driver::new(BASIC_SAMPLE); | ||
driver.compile(CompileStage::Full, true); | ||
driver.clean_binary().unwrap(); | ||
} | ||
|
||
// ------------ unary operators --------- | ||
// | ||
#[test] | ||
#[serial] | ||
fn unary_ir() { | ||
let driver = Driver::new(UNARY_SAMPLE); | ||
driver.compile(CompileStage::IR, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn unary_codegen() { | ||
let driver = Driver::new(UNARY_SAMPLE); | ||
driver.compile(CompileStage::Codegen, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn unary_full() { | ||
let driver = Driver::new(UNARY_SAMPLE); | ||
driver.compile(CompileStage::Full, true); | ||
driver.clean_binary().unwrap(); | ||
} | ||
|
||
// ------------ binary operators --------- | ||
|
||
#[test] | ||
#[serial] | ||
fn binary_ir() { | ||
let driver = Driver::new(BINARY_SAMPLE); | ||
driver.compile(CompileStage::IR, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn binary_codegen() { | ||
let driver = Driver::new(BINARY_SAMPLE); | ||
driver.compile(CompileStage::Codegen, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn binary_full() { | ||
let driver = Driver::new(BINARY_SAMPLE); | ||
driver.compile(CompileStage::Full, true); | ||
driver.clean_binary().unwrap(); | ||
} | ||
|
||
// ------------ division operators --------- | ||
|
||
#[test] | ||
#[serial] | ||
fn div_ir() { | ||
let driver = Driver::new(DIV_SAMPLE); | ||
driver.compile(CompileStage::IR, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn div_codegen() { | ||
let driver = Driver::new(DIV_SAMPLE); | ||
driver.compile(CompileStage::Codegen, true); | ||
} | ||
|
||
#[test] | ||
#[serial] | ||
fn div_full() { | ||
let driver = Driver::new(DIV_SAMPLE); | ||
driver.compile(CompileStage::Full, true); | ||
driver.clean_binary().unwrap(); | ||
} | ||
|