예제 #1
0
TEST_F(Helium_100_Test, TestCollectValidConfig)
{
    unsigned char config1[CFG_FRAME_LENGTH] = {0x00,0x87,0x01,0x01,0x00,0x00,0xa8,0x3c,0x02,0x00,0x08,0xab,0x06,0x00,0x56,0x41,0x33,0x4f,0x52,0x42,0x56,0x45,0x32,0x43,0x55,0x41,0x05,0x00,0x00,0x00,0x41,0x80,0x00,0x00};
    unsigned char config2[CFG_FRAME_LENGTH] = {0x00,0x00,0x01,0x01,0x00,0x00,0x48,0x33,0x02,0x00,0x98,0x93,0x06,0x00,0x56,0x41,0x33,0x4F,0x52,0x42,0x56,0x45,0x32,0x43,0x55,0x41,0x09,0x00,0x00,0x00,0x43,0x00,0x00,0x00}; 

    struct he100_settings test_settings_1 = HE100_collectConfig(config1);
    struct he100_settings test_settings_2 = HE100_collectConfig(config2);

    int validation_result = 1; 
    validation_result = HE100_validateConfig(test_settings_1);

    FILE *test_log;
    test_log = Shakespeare::open_log(LOG_PATH,PROCESS);
    if (test_log != NULL) {
      HE100_printSettings( test_log, test_settings_1 );
      HE100_printSettings( test_log, test_settings_2 );
      fclose(test_log);
    }

    ASSERT_EQ (0, validation_result);   
    validation_result = HE100_validateConfig(test_settings_2);
    ASSERT_EQ (0, validation_result);   
}
TEST_F(Helium_100_Live_Radio_Test, SetConfig)
{
    unsigned char config[CFG_PAYLOAD_LENGTH] = {0x00,0x00,0x01,0x01,0x00,0x00,0x48,0x33,0x02,0x00,0x98,0x93,0x06,0x00,0x56,0x41,0x33,0x4f,0x52,0x42,0x56,0x45,0x32,0x43,0x55,0x41,0x05,0x00,0x00,0x00,0x41,0x80,0x00,0x00};
    struct he100_settings settings = HE100_collectConfig(config);

    FILE *test_log;
    test_log = Shakespeare::open_log(LOG_PATH,PROCESS);
    HE100_printSettings( test_log, settings );
    fclose(test_log);

    int result = HE100_setConfig(fdin,settings);

    ASSERT_EQ(CS1_SUCCESS,result);
}
예제 #3
0
TEST_F(Helium_100_Test, PrepareConfig) 
{
    unsigned char config1[CFG_PAYLOAD_LENGTH] = {0x00,0x00,0x01,0x01,0x00,0x00,0xa8,0x3c,0x02,0x00,0x08,0xab,0x06,0x00,0x56,0x41,0x33,0x4f,0x52,0x42,0x56,0x45,0x32,0x43,0x55,0x41,0x00,0x00,0x00,0x00,0x41,0x80,0x00,0x00};

    unsigned char config_result[CFG_PAYLOAD_LENGTH] = {0};
    struct he100_settings test_settings = HE100_collectConfig(config1);
    HE100_printSettings( stdout, test_settings );

    //HE100_swapConfigEndianness(test_settings);

    ASSERT_EQ(
        CS1_SUCCESS,
        HE100_prepareConfig(*config_result, test_settings)
    );
    printf ("Byte: x \t CFG_BYTE_LIST             \t Exp\t :\t Act\n");
    for (z=0; z<CFG_PAYLOAD_LENGTH; z++) {
        printf ("Byte: %d \t %s \t 0x%X\t :\t 0x%X\n",z,CFG_BYTE_LIST[z],config1[z],config_result[z]);
        ASSERT_EQ(
            config1[z],
            config_result[z]
        );
    }
}