|  | @@ -10,16 +10,16 @@ void testByteBuffer()
 | 
	
		
			
				|  |  |      BYTE_BUFFER buffer;
 | 
	
		
			
				|  |  |      char bytes[] = {0xcd, 0xef, 0x12};
 | 
	
		
			
				|  |  |      TEST_START;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      buffer = createByteBuffer();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      pushByte(&buffer, 0xab);
 | 
	
		
			
				|  |  |      pushBytes(&buffer, bytes, 3);
 | 
	
		
			
				|  |  |      pushWord(&buffer, 0x3456);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      printf("Should: AB CD EF 12 34 56\nGet: ");
 | 
	
		
			
				|  |  |      printfByteBuffer(buffer);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      destroyByteBuffer(buffer);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -28,12 +28,12 @@ void testPrintBits()
 | 
	
		
			
				|  |  |      BYTE_BUFFER buffer;
 | 
	
		
			
				|  |  |      char bytes[] = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0};
 | 
	
		
			
				|  |  |      TEST_START;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      buffer = createByteBuffer();
 | 
	
		
			
				|  |  |      pushBytes(&buffer, bytes, 8);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      printfBitBuffer(buffer);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      destroyByteBuffer(buffer);
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -42,10 +42,9 @@ void testEncode()
 | 
	
		
			
				|  |  |      unsigned char srcByte = 0x28;
 | 
	
		
			
				|  |  |      unsigned short int encWord;
 | 
	
		
			
				|  |  |      TEST_START;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      encWord = encodeByte(srcByte);
 | 
	
		
			
				|  |  |      printf("Input: %02X\nShould: 0x5995\nGet: %04X\n", srcByte, encWord);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -54,10 +53,9 @@ void testDecode()
 | 
	
		
			
				|  |  |      unsigned short int srcWord = 0x5995;
 | 
	
		
			
				|  |  |      unsigned char decByte;
 | 
	
		
			
				|  |  |      TEST_START;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      decByte = decodeByte(srcWord);
 | 
	
		
			
				|  |  |      printf("Input: %04X\nShould: 0x28\nGet: %02X\n", srcWord, decByte);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  void testHomeEasyEncode()
 | 
	
	
		
			
				|  | @@ -66,16 +64,16 @@ void testHomeEasyEncode()
 | 
	
		
			
				|  |  |      BYTE_BUFFER encoded;
 | 
	
		
			
				|  |  |      unsigned char bytes[] = {0x28, 0x28, 0x01};
 | 
	
		
			
				|  |  |      TEST_START;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      source = createByteBuffer();
 | 
	
		
			
				|  |  |      pushBytes(&source, bytes, 3);
 | 
	
		
			
				|  |  |      printf("Input: ");
 | 
	
		
			
				|  |  |      printfByteBuffer(source);
 | 
	
		
			
				|  |  |      printf("Should: 59 95 59 95 55 56\nGet:    ");
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      encoded = homeEasyEncode(&source);
 | 
	
		
			
				|  |  |      printfByteBuffer(encoded);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      destroyByteBuffer(source);
 | 
	
		
			
				|  |  |      destroyByteBuffer(encoded);
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -86,16 +84,16 @@ void testHomeEasyDecode()
 | 
	
		
			
				|  |  |      BYTE_BUFFER decoded;
 | 
	
		
			
				|  |  |      unsigned char bytes[] = {0x59, 0x95, 0x59, 0x95, 0x55, 0x56};
 | 
	
		
			
				|  |  |      TEST_START;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      source = createByteBuffer();
 | 
	
		
			
				|  |  |      pushBytes(&source, bytes, 6);
 | 
	
		
			
				|  |  |      printf("Input: ");
 | 
	
		
			
				|  |  |      printfByteBuffer(source);
 | 
	
		
			
				|  |  |      printf("Should: 28 28 01\nGet:    ");
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      decoded = homeEasyDecode(&source);
 | 
	
		
			
				|  |  |      printfByteBuffer(decoded);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      destroyByteBuffer(source);
 | 
	
		
			
				|  |  |      destroyByteBuffer(decoded);
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -107,13 +105,13 @@ void testHomeEasyCommand(char section, unsigned char num, unsigned char onOff)
 | 
	
		
			
				|  |  |      BYTE_BUFFER encoded;
 | 
	
		
			
				|  |  |      unsigned char id[] = {0x28, 0x28, 0x01, 0x80};
 | 
	
		
			
				|  |  |      TEST_START;
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      command = createHomeEasyCommand(id, section, num, onOff);
 | 
	
		
			
				|  |  |      printfByteBuffer(command);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      encoded = homeEasyEncode(&command);
 | 
	
		
			
				|  |  |      printfByteBuffer(encoded);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      destroyByteBuffer(command);
 | 
	
		
			
				|  |  |      destroyByteBuffer(encoded);
 | 
	
		
			
				|  |  |  }
 | 
	
	
		
			
				|  | @@ -121,21 +119,20 @@ void testHomeEasyCommand(char section, unsigned char num, unsigned char onOff)
 | 
	
		
			
				|  |  |  int main()
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |      printf("Test\n");
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      testByteBuffer();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    //testBitBuffer();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      testPrintBits();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      testEncode();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      testDecode();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      testHomeEasyEncode();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      testHomeEasyDecode();
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | -    testHomeEasyCommand('D', 4, ON);
 | 
	
		
			
				|  |  | -    
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    testHomeEasyCommand('D', 4, OFF);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      return 0;
 | 
	
		
			
				|  |  |  }
 |