fn it_works()

in src/lib.rs [581:649]


    fn it_works() {
        #[cfg(feature = "terminal-logging")]
        simple_logger::init().unwrap();
        {
            assert!(promote_current_thread_to_real_time(0, 0).is_err());
        }
        {
            match promote_current_thread_to_real_time(0, 44100) {
                Ok(rt_prio_handle) => {
                    demote_current_thread_from_real_time(rt_prio_handle).unwrap();
                    assert!(true);
                }
                Err(e) => {
                    eprintln!("{}", e);
                    assert!(false);
                }
            }
        }
        {
            match promote_current_thread_to_real_time(512, 44100) {
                Ok(rt_prio_handle) => {
                    demote_current_thread_from_real_time(rt_prio_handle).unwrap();
                    assert!(true);
                }
                Err(e) => {
                    eprintln!("{}", e);
                    assert!(false);
                }
            }
        }
        {
            // Try larger values to test https://github.com/mozilla/audio_thread_priority/pull/23
            match promote_current_thread_to_real_time(0, 192000) {
                Ok(rt_prio_handle) => {
                    demote_current_thread_from_real_time(rt_prio_handle).unwrap();
                    assert!(true);
                }
                Err(e) => {
                    eprintln!("{}", e);
                    assert!(false);
                }
            }
        }
        {
            // Try larger values to test https://github.com/mozilla/audio_thread_priority/pull/23
            match promote_current_thread_to_real_time(8192, 48000) {
                Ok(rt_prio_handle) => {
                    demote_current_thread_from_real_time(rt_prio_handle).unwrap();
                    assert!(true);
                }
                Err(e) => {
                    eprintln!("{}", e);
                    assert!(false);
                }
            }
        }
        {
            match promote_current_thread_to_real_time(512, 44100) {
                Ok(_) => {
                    assert!(true);
                }
                Err(e) => {
                    eprintln!("{}", e);
                    assert!(false);
                }
            }
            // automatically deallocated, but not demoted until the thread exits.
        }
    }