2022-02-25 19:41:10 +03:00
|
|
|
// Your task is to replace the '??' sections so the code compiles.
|
2023-05-29 20:39:08 +03:00
|
|
|
//
|
2022-07-16 20:51:50 +03:00
|
|
|
// Don't change any line other than the marked one.
|
2022-02-25 19:41:10 +03:00
|
|
|
|
2024-05-22 16:04:12 +03:00
|
|
|
trait Licensed {
|
2022-02-25 19:41:10 +03:00
|
|
|
fn licensing_info(&self) -> String {
|
|
|
|
"some information".to_string()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct SomeSoftware {}
|
|
|
|
|
|
|
|
struct OtherSoftware {}
|
|
|
|
|
|
|
|
impl Licensed for SomeSoftware {}
|
|
|
|
impl Licensed for OtherSoftware {}
|
|
|
|
|
2022-07-16 20:51:50 +03:00
|
|
|
// YOU MAY ONLY CHANGE THE NEXT LINE
|
2022-02-25 19:41:10 +03:00
|
|
|
fn compare_license_types(software: ??, software_two: ??) -> bool {
|
|
|
|
software.licensing_info() == software_two.licensing_info()
|
|
|
|
}
|
|
|
|
|
2024-04-17 23:46:21 +03:00
|
|
|
fn main() {
|
|
|
|
// You can optionally experiment here.
|
|
|
|
}
|
|
|
|
|
2022-02-25 19:41:10 +03:00
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn compare_license_information() {
|
|
|
|
let some_software = SomeSoftware {};
|
|
|
|
let other_software = OtherSoftware {};
|
|
|
|
|
|
|
|
assert!(compare_license_types(some_software, other_software));
|
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn compare_license_information_backwards() {
|
|
|
|
let some_software = SomeSoftware {};
|
|
|
|
let other_software = OtherSoftware {};
|
|
|
|
|
|
|
|
assert!(compare_license_types(other_software, some_software));
|
|
|
|
}
|
|
|
|
}
|