Solved all warnings in `tests/`

pull/49/head
Meliurwen 2 years ago
parent c4f44f63ea
commit d0515a3f26
  1. 4
      tests/parameter_learning.rs
  2. 4
      tests/params.rs
  3. 4
      tests/structure_learning.rs
  4. 2
      tests/tools.rs
  5. 7
      tests/utils.rs

@ -1,3 +1,5 @@
#![allow(non_snake_case)]
mod utils; mod utils;
use utils::*; use utils::*;
@ -6,9 +8,7 @@ use reCTBN::ctbn::*;
use reCTBN::network::Network; use reCTBN::network::Network;
use reCTBN::parameter_learning::*; use reCTBN::parameter_learning::*;
use reCTBN::{params, tools::*}; use reCTBN::{params, tools::*};
use std::collections::BTreeSet;
#[macro_use]
extern crate approx; extern crate approx;
fn learn_binary_cim<T: ParameterLearning>(pl: T) { fn learn_binary_cim<T: ParameterLearning>(pl: T) {

@ -7,8 +7,8 @@ mod utils;
#[macro_use] #[macro_use]
extern crate approx; extern crate approx;
fn create_ternary_discrete_time_continous_param() -> DiscreteStatesContinousTimeParams { fn create_ternary_discrete_time_continous_param() -> DiscreteStatesContinousTimeParams {
#![allow(unused_must_use)]
let mut params = utils::generate_discrete_time_continous_params("A".to_string(), 3); let mut params = utils::generate_discrete_time_continous_params("A".to_string(), 3);
let cim = array![[[-3.0, 2.0, 1.0], [1.0, -5.0, 4.0], [2.3, 1.7, -4.0]]]; let cim = array![[[-3.0, 2.0, 1.0], [1.0, -5.0, 4.0], [2.3, 1.7, -4.0]]];
@ -25,6 +25,7 @@ fn test_get_label() {
#[test] #[test]
fn test_uniform_generation() { fn test_uniform_generation() {
#![allow(irrefutable_let_patterns)]
let param = create_ternary_discrete_time_continous_param(); let param = create_ternary_discrete_time_continous_param();
let mut states = Array1::<usize>::zeros(10000); let mut states = Array1::<usize>::zeros(10000);
@ -44,6 +45,7 @@ fn test_uniform_generation() {
#[test] #[test]
fn test_random_generation_state() { fn test_random_generation_state() {
#![allow(irrefutable_let_patterns)]
let param = create_ternary_discrete_time_continous_param(); let param = create_ternary_discrete_time_continous_param();
let mut states = Array1::<usize>::zeros(10000); let mut states = Array1::<usize>::zeros(10000);

@ -1,3 +1,5 @@
#![allow(non_snake_case)]
mod utils; mod utils;
use utils::*; use utils::*;
@ -95,7 +97,7 @@ fn check_compatibility_between_dataset_and_network<T: StructureLearningAlgorithm
let _n1 = net let _n1 = net
.add_node(generate_discrete_time_continous_node(String::from("n1"), 3)) .add_node(generate_discrete_time_continous_node(String::from("n1"), 3))
.unwrap(); .unwrap();
let net = sl.fit_transform(net, &data); let _net = sl.fit_transform(net, &data);
} }
#[test] #[test]

@ -3,7 +3,6 @@ use reCTBN::ctbn::*;
use reCTBN::network::Network; use reCTBN::network::Network;
use reCTBN::params; use reCTBN::params;
use reCTBN::tools::*; use reCTBN::tools::*;
use std::collections::BTreeSet;
#[macro_use] #[macro_use]
extern crate approx; extern crate approx;
@ -12,6 +11,7 @@ mod utils;
#[test] #[test]
fn run_sampling() { fn run_sampling() {
#![allow(unused_must_use)]
let mut net = CtbnNetwork::new(); let mut net = CtbnNetwork::new();
let n1 = net let n1 = net
.add_node(utils::generate_discrete_time_continous_node( .add_node(utils::generate_discrete_time_continous_node(

@ -1,17 +1,12 @@
use reCTBN::params; use reCTBN::params;
use std::collections::BTreeSet; use std::collections::BTreeSet;
#[allow(dead_code)]
pub fn generate_discrete_time_continous_node(label: String, cardinality: usize) -> params::Params { pub fn generate_discrete_time_continous_node(label: String, cardinality: usize) -> params::Params {
params::Params::DiscreteStatesContinousTime(generate_discrete_time_continous_params(label, cardinality)) params::Params::DiscreteStatesContinousTime(generate_discrete_time_continous_params(label, cardinality))
} }
pub fn generate_discrete_time_continous_params(label: String, cardinality: usize) -> params::DiscreteStatesContinousTimeParams{ pub fn generate_discrete_time_continous_params(label: String, cardinality: usize) -> params::DiscreteStatesContinousTimeParams{
let domain: BTreeSet<String> = (0..cardinality).map(|x| x.to_string()).collect(); let domain: BTreeSet<String> = (0..cardinality).map(|x| x.to_string()).collect();
params::DiscreteStatesContinousTimeParams::new(label, domain) params::DiscreteStatesContinousTimeParams::new(label, domain)
} }

Loading…
Cancel
Save