use rand::prelude::*;

fn shared() -> i32 { // Tracked
    let a = 100;

    a / 2
}

pub fn good_function(val: i32) -> bool { // Tracked
    let a = val + 10;

    let b = |c: i32| {
        let d = c - 5;
        d * 2
    };
  
    fn c() {
      println!();
    }

    if b(a) == (a - 5) * 2 
    {
        return true;
    }

    false
}

pub fn flaky_function() -> bool { // Tracked
    let mut rng = rand::thread_rng();
    let value: f32 = rng.gen();

    match value {
        0.9..=1.0 => false,
        _ => true,
    }
}

pub fn failing_function() -> bool { // Tracked
    let _b = true; // Addition to simulate modifying actual failing test
    false
}

mod a {
  struct A{}
  impl A {
    fn method() {
        return true;
    }
  }

  fn another_method() { // Tracked 
      return true;
  }
}

#[cfg(test)]
mod test {
    use super::*;

    #[test]
    fn test_pass() { // Tracked
        let result = good_function(1);
        assert_eq!(result, true);
    }

    #[test]
    fn test_flaky() { // Tracked
        let result = flaky_function();
        assert_eq!(result, true);
    }

    #[test]
    fn test_fail() { // Tracked
        let result = failing_function();
        assert_eq!(result, true);
    }
}
