-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/flatbox: provide slice accessors
and give more allocation responsibility to shared_memory Pull request: #2 Approved by: MichaelHirn
- Loading branch information
Showing
5 changed files
with
104 additions
and
37 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
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
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,26 @@ | ||
extern crate collenchyma as co; | ||
extern crate libc; | ||
|
||
#[cfg(test)] | ||
mod shared_memory_spec { | ||
|
||
use co::framework::IFramework; | ||
use co::frameworks::Native; | ||
|
||
use co::device::{IDevice, DeviceType}; | ||
use co::memory::MemoryType; | ||
|
||
use co::shared_memory::*; | ||
|
||
#[test] | ||
fn it_creates_buffer() { | ||
let ntv = Native::new(); | ||
let cpu = ntv.new_device(ntv.hardwares()).unwrap(); | ||
let cpu_dev = &mut DeviceType::Native(cpu.clone()); | ||
let shared_data = &mut SharedMemory::<f32>::new(cpu_dev, 10); | ||
if let &MemoryType::Native(ref dat) = shared_data.get(cpu_dev).unwrap() { | ||
let data = dat.as_slice::<f32>(); | ||
assert_eq!(10, data.len()); | ||
} | ||
} | ||
} |