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:
@@ -285,6 +285,7 @@ mod tests {
|
||||
use crate::model_selection::kfold::KFold;
|
||||
use crate::neighbors::knn_regressor::KNNRegressor;
|
||||
|
||||
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
||||
#[test]
|
||||
fn run_train_test_split() {
|
||||
let n = 123;
|
||||
@@ -308,6 +309,7 @@ mod tests {
|
||||
#[derive(Clone)]
|
||||
struct NoParameters {}
|
||||
|
||||
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
||||
#[test]
|
||||
fn test_cross_validate_biased() {
|
||||
struct BiasedEstimator {}
|
||||
@@ -367,6 +369,7 @@ mod tests {
|
||||
assert_eq!(0.4, results.mean_train_score());
|
||||
}
|
||||
|
||||
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
||||
#[test]
|
||||
fn test_cross_validate_knn() {
|
||||
let x = DenseMatrix::from_2d_array(&[
|
||||
@@ -411,6 +414,7 @@ mod tests {
|
||||
assert!(results.mean_train_score() < results.mean_test_score());
|
||||
}
|
||||
|
||||
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
|
||||
#[test]
|
||||
fn test_cross_val_predict_knn() {
|
||||
let x = DenseMatrix::from_2d_array(&[
|
||||
|
||||
Reference in New Issue
Block a user