mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-11-04 09:00:05 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
	
		
			773 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
	
		
			773 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#include <scwx/network/ntp_client.hpp>
 | 
						|
 | 
						|
#include <gtest/gtest.h>
 | 
						|
 | 
						|
namespace scwx
 | 
						|
{
 | 
						|
namespace network
 | 
						|
{
 | 
						|
 | 
						|
TEST(NtpClient, Poll)
 | 
						|
{
 | 
						|
   NtpClient client {};
 | 
						|
 | 
						|
   const std::string firstServer   = client.RotateServer();
 | 
						|
   std::string       currentServer = firstServer;
 | 
						|
   std::string       lastServer    = firstServer;
 | 
						|
   bool              error         = false;
 | 
						|
 | 
						|
   do
 | 
						|
   {
 | 
						|
      client.RunOnce();
 | 
						|
      error = client.error();
 | 
						|
 | 
						|
      EXPECT_EQ(error, false);
 | 
						|
 | 
						|
      // Loop until the current server repeats the first server, or fails to
 | 
						|
      // rotate
 | 
						|
      lastServer    = currentServer;
 | 
						|
      currentServer = client.RotateServer();
 | 
						|
   } while (currentServer != firstServer && currentServer != lastServer &&
 | 
						|
            !error);
 | 
						|
}
 | 
						|
 | 
						|
} // namespace network
 | 
						|
} // namespace scwx
 |