1+ use crate :: tests:: DEFAULT_TEST_CLIENT ;
2+
13#[ test]
24fn client_can_open ( ) {
35 let ( client, status) =
@@ -7,34 +9,34 @@ fn client_can_open() {
79 assert_ne ! ( client. sample_rate( ) , 0 ) ;
810 assert_ne ! ( client. buffer_size( ) , 0 ) ;
911 assert_ne ! ( client. uuid_string( ) , "" ) ;
12+ assert_ne ! ( client. uuid( ) , 0 ) ;
1013 let cpu_load = client. cpu_load ( ) ;
1114 assert ! ( cpu_load > 0.0 , "client.cpu_load() = {}" , cpu_load) ;
1215}
1316
1417#[ test]
1518fn time_is_montonically_increasing ( ) {
16- let ( client, _) = crate :: Client :: new ( "" , crate :: ClientOptions :: empty ( ) ) . unwrap ( ) ;
17-
18- let t0 = client. time ( ) ;
19- let frames0 = client. frames_since_cycle_start ( ) ;
20- let frame_time0 = client. frame_time ( ) ;
19+ let t0 = DEFAULT_TEST_CLIENT . time ( ) ;
20+ let frames0 = DEFAULT_TEST_CLIENT . frames_since_cycle_start ( ) ;
21+ let frame_time0 = DEFAULT_TEST_CLIENT . frame_time ( ) ;
2122
2223 std:: thread:: sleep ( std:: time:: Duration :: from_millis ( 50 ) ) ;
23- assert_ne ! ( client . time( ) , t0) ;
24- assert_ne ! ( client . frames_since_cycle_start( ) , frames0) ;
25- assert_ne ! ( client . frame_time( ) , frame_time0) ;
24+ assert_ne ! ( DEFAULT_TEST_CLIENT . time( ) , t0) ;
25+ assert_ne ! ( DEFAULT_TEST_CLIENT . frames_since_cycle_start( ) , frames0) ;
26+ assert_ne ! ( DEFAULT_TEST_CLIENT . frame_time( ) , frame_time0) ;
2627}
2728
2829#[ test]
2930fn maybe_client_can_set_buffer_size ( ) {
30- let ( client, _) = crate :: Client :: new ( "" , crate :: ClientOptions :: empty ( ) ) . unwrap ( ) ;
31- let initial_buffer_size = client. buffer_size ( ) ;
32- if let Err ( err) = client. set_buffer_size ( initial_buffer_size * 2 ) {
31+ let initial_buffer_size = DEFAULT_TEST_CLIENT . buffer_size ( ) ;
32+ if let Err ( err) = DEFAULT_TEST_CLIENT . set_buffer_size ( initial_buffer_size * 2 ) {
3333 eprintln ! ( "client does not support setting buffer size: {err}" ) ;
3434 return ;
3535 }
36- assert_eq ! ( client. buffer_size( ) , 2 * initial_buffer_size) ;
37- client. set_buffer_size ( initial_buffer_size) . unwrap ( ) ;
36+ assert_eq ! ( DEFAULT_TEST_CLIENT . buffer_size( ) , 2 * initial_buffer_size) ;
37+ DEFAULT_TEST_CLIENT
38+ . set_buffer_size ( initial_buffer_size)
39+ . unwrap ( ) ;
3840}
3941
4042#[ test]
@@ -76,12 +78,11 @@ fn uuid_can_map_to_client_name() {
7678
7779#[ test]
7880fn nonexistant_uuid_to_client_name_returns_none ( ) {
79- let ( client1, _) = crate :: Client :: new ( "" , crate :: ClientOptions :: default ( ) ) . unwrap ( ) ;
80- let ( client2, _) =
81+ let ( client, _) =
8182 crate :: Client :: new ( "dropped-client" , crate :: ClientOptions :: default ( ) ) . unwrap ( ) ;
82- let uuid_string = client2 . uuid_string ( ) ;
83- let uuid = client2 . uuid ( ) ;
84- drop ( client2 ) ;
85- assert_eq ! ( client1 . name_by_uuid_str( & uuid_string) , None ) ;
86- assert_eq ! ( client1 . name_by_uuid( uuid) , None ) ;
83+ let uuid_string = client . uuid_string ( ) ;
84+ let uuid = client . uuid ( ) ;
85+ drop ( client ) ;
86+ assert_eq ! ( DEFAULT_TEST_CLIENT . name_by_uuid_str( & uuid_string) , None ) ;
87+ assert_eq ! ( DEFAULT_TEST_CLIENT . name_by_uuid( uuid) , None ) ;
8788}
0 commit comments