|  | @@ -1,18 +1,26 @@
 | 
		
	
		
			
			| 1 | 1 |  #include <iostream>
 | 
		
	
		
			
			|  | 2 | +#include <string.h>
 | 
		
	
		
			
			|  | 3 | +#include <gtest/gtest.h>
 | 
		
	
		
			
			| 2 | 4 |  #include <ScHex.h>
 | 
		
	
		
			
			| 3 | 5 |  #include <ScReader.h>
 | 
		
	
		
			
			| 4 | 6 |  
 | 
		
	
		
			
			| 5 |  | -int main()
 | 
		
	
		
			
			|  | 7 | +#define TEST_byteArrayToString(STR, DATA, SIZE) \
 | 
		
	
		
			
			|  | 8 | +  EXPECT_EQ(STR, ScHex::byteArrayToString(ScByteArray((BYTE*)memcpy(new BYTE[SIZE], DATA, SIZE), SIZE)))
 | 
		
	
		
			
			|  | 9 | +
 | 
		
	
		
			
			|  | 10 | +TEST(Hex, ByteToString)
 | 
		
	
		
			
			|  | 11 | +{
 | 
		
	
		
			
			|  | 12 | +  TEST_byteArrayToString("", "", 0);
 | 
		
	
		
			
			|  | 13 | +  TEST_byteArrayToString("42", "\x42", 1);
 | 
		
	
		
			
			|  | 14 | +  TEST_byteArrayToString("42 00 FF AA 24", "\x42\x00\xff\xaa\x24", 5);
 | 
		
	
		
			
			|  | 15 | +  TEST_byteArrayToString("00 01 02 03 04 05 06 FF", "\x00\x01\x02\x03\x04\x05\x06\xff", 8);
 | 
		
	
		
			
			|  | 16 | +}
 | 
		
	
		
			
			|  | 17 | +
 | 
		
	
		
			
			|  | 18 | +int main(int argc, char* argv[])
 | 
		
	
		
			
			| 6 | 19 |  {
 | 
		
	
		
			
			| 7 |  | -  auto bytes = new BYTE[5];
 | 
		
	
		
			
			| 8 |  | -  bytes[0] = 0x42;
 | 
		
	
		
			
			| 9 |  | -  bytes[1] = 0x00;
 | 
		
	
		
			
			| 10 |  | -  bytes[2] = 0xff;
 | 
		
	
		
			
			| 11 |  | -  bytes[3] = 0xaa;
 | 
		
	
		
			
			| 12 |  | -  bytes[4] = 0x24;
 | 
		
	
		
			
			| 13 |  | -  std::cout << "hex: " << ScHex::byteArrayToString(ScByteArray(bytes, 5)) << std::endl;
 | 
		
	
		
			
			|  | 20 | +  ::testing::InitGoogleTest(&argc, argv);
 | 
		
	
		
			
			|  | 21 | +  return RUN_ALL_TESTS();
 | 
		
	
		
			
			| 14 | 22 |  
 | 
		
	
		
			
			| 15 |  | -  std::cout << ScReader::establishContext() << std::endl;
 | 
		
	
		
			
			|  | 23 | +  /*std::cout << ScReader::establishContext() << std::endl;
 | 
		
	
		
			
			| 16 | 24 |    auto readers = ScReader::getReaders();
 | 
		
	
		
			
			| 17 | 25 |    for (auto reader : readers)
 | 
		
	
		
			
			| 18 | 26 |    {
 | 
		
	
	
		
			
			|  | @@ -22,5 +30,5 @@ int main()
 | 
		
	
		
			
			| 22 | 30 |      std::cout << std::endl;
 | 
		
	
		
			
			| 23 | 31 |    }
 | 
		
	
		
			
			| 24 | 32 |    std::cout << ScReader::freeContext() << std::endl;
 | 
		
	
		
			
			| 25 |  | -  return 0;
 | 
		
	
		
			
			|  | 33 | +  return 0;*/
 | 
		
	
		
			
			| 26 | 34 |  }
 |