feat: added support to wasm (#94)

* test: run tests also in wasm targets

* fix: install rand with wasm-bindgen por wasm targets

* fix: use actual usize size to access buffer.

* fix: do not run functions that create files in wasm.

* test: do not run in wasm test that panics.

Co-authored-by: Luis Moreno <morenol@users.noreply.github.com>
This commit is contained in:
Luis Moreno
2021-04-28 15:58:39 -04:00
committed by GitHub
parent 5ed5772a4e
commit 162bed2aa2
71 changed files with 294 additions and 51 deletions
+4
View File
@@ -640,6 +640,7 @@ mod tests {
use super::*;
use crate::linalg::naive::dense_matrix::DenseMatrix;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
fn gini_impurity() {
assert!(
@@ -656,6 +657,7 @@ mod tests {
);
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
fn fit_predict_iris() {
let x = DenseMatrix::from_2d_array(&[
@@ -708,6 +710,7 @@ mod tests {
);
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
fn fit_predict_baloons() {
let x = DenseMatrix::from_2d_array(&[
@@ -744,6 +747,7 @@ mod tests {
);
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
#[cfg(feature = "serde")]
fn serde() {
+2
View File
@@ -506,6 +506,7 @@ mod tests {
use super::*;
use crate::linalg::naive::dense_matrix::DenseMatrix;
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
fn fit_longley() {
let x = DenseMatrix::from_2d_array(&[
@@ -580,6 +581,7 @@ mod tests {
}
}
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
#[cfg(feature = "serde")]
fn serde() {