MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / Test_identity

Function Test_identity

tests/test_connection.cpp:627–667  ·  view source on GitHub ↗

Some tests for identity string handling. Doesn't really have anything to do with connectivity, this is just a conveinent place for this to live

Source from the content-addressed store, hash-verified

625// Some tests for identity string handling. Doesn't really have anything to do with
626// connectivity, this is just a conveinent place for this to live
627void Test_identity()
628{
629 SteamNetworkingIdentity id1, id2;
630 char tempBuf[ SteamNetworkingIdentity::k_cchMaxString ];
631
632 {
633 CSteamID steamID( 1234, k_EUniversePublic, k_EAccountTypeIndividual );
634 id1.SetSteamID( steamID );
635 id1.ToString( tempBuf, sizeof(tempBuf ) );
636 assert( id2.ParseString( tempBuf ) );
637 assert( id2.GetSteamID() == steamID );
638 }
639
640 {
641 const char *pszTempXBoxID = "8fg37rfsdf";
642 assert( id1.SetXboxPairwiseID( pszTempXBoxID ) );
643 id1.ToString( tempBuf, sizeof(tempBuf ) );
644 assert( id2.ParseString( tempBuf ) );
645 assert( strcmp( id2.GetXboxPairwiseID(), pszTempXBoxID ) == 0 );
646 }
647
648 {
649 const char *pszTempIPAddr = "ip:192.168.0.0:27015";
650 assert( id1.ParseString( pszTempIPAddr ) );
651 id1.ToString( tempBuf, sizeof(tempBuf ) );
652 assert( strcmp( tempBuf, pszTempIPAddr ) == 0 );
653
654 id1.SetLocalHost();
655 id1.ToString( tempBuf, sizeof(tempBuf ) );
656 assert( strcmp( tempBuf, "ip:::1" ) == 0 );
657 }
658
659 {
660 const char *pszTempGenStr = "Locke Lamora";
661 assert( id1.SetGenericString( pszTempGenStr ) );
662 id1.ToString( tempBuf, sizeof(tempBuf ) );
663 assert( strcmp( tempBuf, "str:Locke Lamora" ) == 0 );
664 assert( id2.ParseString( tempBuf ) );
665 assert( strcmp( id2.GetGenericString(), pszTempGenStr ) == 0 );
666 }
667}
668
669void Test_lane_quick_queueanddrain()
670{

Callers

nothing calls this directly

Calls 9

SetSteamIDMethod · 0.80
ParseStringMethod · 0.80
GetSteamIDMethod · 0.80
SetXboxPairwiseIDMethod · 0.80
GetXboxPairwiseIDMethod · 0.80
SetLocalHostMethod · 0.80
SetGenericStringMethod · 0.80
GetGenericStringMethod · 0.80
ToStringMethod · 0.45

Tested by

no test coverage detected