1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
///A trait that describes how to implement support for a new game.
mod game_trait;
///An enum that contains all the supported games, so that you can use match.
pub mod games_enum;
///A enum that represents the platform that the library is currently running on.
mod platform;
///A module for each profile that represents the sensitivities for each game in that profile.
mod profile;
///A module that manages a vector of profiles so that you are able to perform functions with all of your profiles at once.
pub mod profile_manager;
//A profile that stores the paths to various steam folders on the current system.
mod steam_folder;

#[cfg(test)]
mod tests {
    use crate::games_enum::SupportedGames;
    use crate::profile_manager::Profiles;

    #[test]
    fn profiles_new() {
        let mut x = Profiles::new();
        x.add_profile();
    }
    #[test]
    fn manipulate_profiles() {
        let mut x = Profiles::new();
        x.add_profile();
        x.set_platform();
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
    }
    #[test]
    fn set_paths() {
        let mut x = Profiles::new();
        x.add_profile();
        x.set_platform();
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        x.set_paths().unwrap();
    }
    #[test]
    fn equalize() {
        let mut x = Profiles::new();
        x.add_profile();
        x.set_platform();
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        x.set_paths().unwrap();
        x.equalize_profile_at_index(SupportedGames::CSGO, 0);
    }
    #[test]
    fn save_as_json() {
        let mut x = Profiles::new();
        x.add_profile();
        x.set_platform();
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        x.set_paths().unwrap();
        x.equalize_profile_at_index(SupportedGames::CSGO, 0);
        x.save_json().unwrap();
    }
    #[test]
    fn retrieve_json() {
        //let x = Profiles::fs_load_profiles().unwrap();
    }
    #[test]
    fn to_string() {
        let mut x = Profiles::new();
        x.add_profile();
        x.add_profile();
        x.add_profile();
        x.set_platform();
        x.change_name_at_index(0, "my first profile".to_string());
        x.change_name_at_index(1, "the second profile i have created".to_string());
        x.change_name_at_index(2, "the last profile i will create".to_string());
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        x.add_steam_folder("/home/test/.steam/steam/".to_string());
        println!("Profiles:\n");
        println!("{}", x.to_string(false));
        println!("Steam Folders:\n");
        println!("{}", x.to_string(true));
    }
}