@@ -388,33 +388,54 @@ test_server_description_connection_id (void)
388388 bson_t * hello ;
389389 bson_error_t error ;
390390
391- mongoc_server_description_init (& sd , "host:1234" , 1 );
392- hello = BCON_NEW ("minWireVersion" ,
393- BCON_INT32 (WIRE_VERSION_MIN ),
394- "maxWireVersion" ,
395- BCON_INT32 (WIRE_VERSION_MAX ),
396- "connectionId" ,
397- BCON_INT32 (1 ));
398- memset (& error , 0 , sizeof (bson_error_t ));
399- mongoc_server_description_handle_hello (& sd , hello , 0 /* rtt */ , & error );
400- BSON_ASSERT (sd .type == MONGOC_SERVER_STANDALONE );
401- BSON_ASSERT (sd .server_connection_id == 1 );
402-
403- mongoc_server_description_reset (& sd );
404- bson_destroy (hello );
405- hello = BCON_NEW ("minWireVersion" ,
406- BCON_INT32 (WIRE_VERSION_MIN ),
407- "maxWireVersion" ,
408- BCON_INT32 (WIRE_VERSION_MAX ),
409- "connectionId" ,
410- BCON_INT64 (1 ));
411- memset (& error , 0 , sizeof (bson_error_t ));
412- mongoc_server_description_handle_hello (& sd , hello , 0 /* rtt */ , & error );
413- BSON_ASSERT (sd .type == MONGOC_SERVER_STANDALONE );
414- BSON_ASSERT (sd .server_connection_id == 1 );
415-
416- bson_destroy (hello );
417- mongoc_server_description_cleanup (& sd );
391+ // Test an int32.
392+ {
393+ mongoc_server_description_init (& sd , "host:1234" , 1 );
394+ hello = BCON_NEW ("minWireVersion" ,
395+ BCON_INT32 (WIRE_VERSION_MIN ),
396+ "maxWireVersion" ,
397+ BCON_INT32 (WIRE_VERSION_MAX ),
398+ "connectionId" ,
399+ BCON_INT32 (1 ));
400+ memset (& error , 0 , sizeof (bson_error_t ));
401+ mongoc_server_description_handle_hello (& sd , hello , 0 /* rtt */ , & error );
402+ BSON_ASSERT (sd .type == MONGOC_SERVER_STANDALONE );
403+ ASSERT_CMPINT64 (sd .server_connection_id , = = , 1 );
404+ mongoc_server_description_cleanup (& sd );
405+ bson_destroy (hello );
406+ }
407+ // Test an int64.
408+ {
409+ mongoc_server_description_init (& sd , "host:1234" , 1 );
410+ hello = BCON_NEW ("minWireVersion" ,
411+ BCON_INT32 (WIRE_VERSION_MIN ),
412+ "maxWireVersion" ,
413+ BCON_INT32 (WIRE_VERSION_MAX ),
414+ "connectionId" ,
415+ BCON_INT64 (1 ));
416+ memset (& error , 0 , sizeof (bson_error_t ));
417+ mongoc_server_description_handle_hello (& sd , hello , 0 /* rtt */ , & error );
418+ BSON_ASSERT (sd .type == MONGOC_SERVER_STANDALONE );
419+ ASSERT_CMPINT64 (sd .server_connection_id , = = , 1 );
420+ bson_destroy (hello );
421+ mongoc_server_description_cleanup (& sd );
422+ }
423+ // Test a double.
424+ {
425+ mongoc_server_description_init (& sd , "host:1234" , 1 );
426+ hello = BCON_NEW ("minWireVersion" ,
427+ BCON_INT32 (WIRE_VERSION_MIN ),
428+ "maxWireVersion" ,
429+ BCON_INT32 (WIRE_VERSION_MAX ),
430+ "connectionId" ,
431+ BCON_DOUBLE (1 ));
432+ memset (& error , 0 , sizeof (bson_error_t ));
433+ mongoc_server_description_handle_hello (& sd , hello , 0 /* rtt */ , & error );
434+ BSON_ASSERT (sd .type == MONGOC_SERVER_STANDALONE );
435+ BSON_ASSERT (sd .server_connection_id == 1 );
436+ bson_destroy (hello );
437+ mongoc_server_description_cleanup (& sd );
438+ }
418439}
419440
420441static void
0 commit comments