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
83
84
85
86
87
mod find_first;
pub mod types;
pub mod visa_module;
#[cfg(test)]
mod tests {

    use visa_module::SafeDeviceMap;

    use super::*;

    ///General test to see if the SafeDeviceMap works.
    #[test]
    fn test_mapper() {
        let mapper_res = SafeDeviceMap::init(None);
        match mapper_res {
            Ok(mapper) => {
                let stat = mapper.get_first_device(true);
                match stat {
                    Ok(dev) => {
                        assert_eq!(1, 1);
                        let con = mapper.connect_device(dev.address);
                        if con.is_err() {
                            println!("got error: con error");
                            assert_eq!(1, -11);
                        }
                        let res = mapper.query_from_device(dev.name.clone(), "*IDN?\n");
                        if res.is_ok() {
                            println!("res got {}",res.unwrap());
                        }
                        let dis = mapper.disconnect_device(dev.name);
                        match dis{
                            Ok(_)=>{assert_eq!(1, 1);},
                            Err(e) => {
                                println!("got error: {}", e);
                                assert_eq!(1, -10);
                            }
                        }
                    }
                    Err(e) => {
                        println!("got error: {}", e);
                        assert_eq!(1, -1);
                    }
                }
            }
            Err(e) => {
                println!("got error of {}", e);
                assert_eq!(1, -1);
            }
        }
    }
    ///Tests to find the first USB instrument.
    ///Work with the [`visa::Binary::Default`]
    ///
    ///All these tests are to find out what kind of binary works the best for you, these test will probebly be removed.
    #[test]
    fn it_works_first_default() {
        let result = find_first::test_ni_default_find_first();
        assert_eq!(result, 0);
    }
    ///Tests to find the first USB instrument.
    ///Work with the [`visa::Binary::NiVisa`]
    ///
    ///All these tests are to find out what kind of binary works the best for you, these test will probebly be removed.
    #[test]
    fn it_works_first_visa() {
        let result = find_first::test_ni_visa_find_first();
        assert_eq!(result, 0);
    }
    ///Tests to find the first USB instrument.
    ///Work with the [`visa::Binary::Keysight`]
    ///
    ///All these tests are to find out what kind of binary works the best for you, these test will probebly be removed.
    #[test]
    fn it_works_first_ks() {
        let result = find_first::test_ni_ks_find_first();
        assert_eq!(result, 0);
    }
    ///Tests to find the first USB instrument.
    ///Work with the [`visa::Binary::Custom`]
    ///
    ///All these tests are to find out what kind of binary works the best for you, these test will probebly be removed.
    #[test]
    fn it_works_first_so() {
        let result = find_first::test_ni_so_find_first();
        assert_eq!(result, 0);
    }
}