game-of-life/tests/web.rs

33 lines
662 B
Rust
Raw Normal View History

2020-10-11 21:46:15 +01:00
//! Test suite for the Web and headless browsers.
#![cfg(target_arch = "wasm32")]
extern crate wasm_bindgen_test;
2021-06-22 21:05:22 +01:00
// use wasm_bindgen_test::*;
use wasm_bindgen_test::{wasm_bindgen_test, wasm_bindgen_test_configure};
2020-10-11 21:46:15 +01:00
wasm_bindgen_test_configure!(run_in_browser);
2021-06-22 21:05:22 +01:00
extern crate gameoflife;
use gameoflife::Universe;
2020-10-11 21:46:15 +01:00
#[wasm_bindgen_test]
2021-06-22 21:05:22 +01:00
fn get_width() {
let uni = Universe::new(10, 15, 1, 1.0);
assert_eq!(uni.width(), 10);
2020-10-11 21:46:15 +01:00
}
2021-06-22 21:05:22 +01:00
#[wasm_bindgen_test]
fn get_height() {
let uni = Universe::new(10, 15, 1, 1.0);
assert_eq!(uni.height(), 15);
}
#[wasm_bindgen_test]
fn get_cells() {
let uni = Universe::new(10, 15, 1, 1.0);
uni.cells();
}