当前位置: 首页>>代码示例>>C++>>正文


C++ TEST_ASSERT_EQUAL_PTR函数代码示例

本文整理汇总了C++中TEST_ASSERT_EQUAL_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_ASSERT_EQUAL_PTR函数的具体用法?C++ TEST_ASSERT_EQUAL_PTR怎么用?C++ TEST_ASSERT_EQUAL_PTR使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了TEST_ASSERT_EQUAL_PTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_ByteArray_GetSlice_should_return_a_subarray_of_the_ByteArray

void test_ByteArray_GetSlice_should_return_a_subarray_of_the_ByteArray(void)
{
    uint8_t data[] = {0x1u, 0x2u, 0x3u, 0x4u};
    size_t len = sizeof(data);
    ByteArray array = {.data = data, .len = len};
    size_t sliceLen;

    // Validate slice of full array
    ByteArray slice0 = ByteArray_GetSlice(array, 0, len);
    TEST_ASSERT_EQUAL_PTR(data, slice0.data);
    TEST_ASSERT_EQUAL(len, slice0.len);
    TEST_ASSERT_EQUAL_HEX8_ARRAY(data, slice0.data, len);

    // Validate slice from beginning of array
    sliceLen = len - 1;
    ByteArray slice1 = ByteArray_GetSlice(array, 0, sliceLen);
    TEST_ASSERT_EQUAL_PTR(data, slice1.data);
    TEST_ASSERT_EQUAL(sliceLen, slice1.len);
    TEST_ASSERT_EQUAL_HEX8_ARRAY(data, slice1.data, sliceLen);

    // Validate slice from non-start to the end of the array
    sliceLen = len - 1;
    ByteArray slice2 = ByteArray_GetSlice(array, 1, sliceLen);
    TEST_ASSERT_EQUAL_PTR(&data[1], slice2.data);
    TEST_ASSERT_EQUAL(sliceLen, slice2.len);
    TEST_ASSERT_EQUAL_HEX8_ARRAY(&data[1], slice2.data, sliceLen);

    // Validate slice from middle of the array
    sliceLen = len - 2;
    ByteArray slice3 = ByteArray_GetSlice(array, 1, sliceLen);
    TEST_ASSERT_EQUAL_PTR(&data[1], slice3.data);
    TEST_ASSERT_EQUAL(sliceLen, slice3.len);
    TEST_ASSERT_EQUAL_HEX8_ARRAY(&data[1], slice3.data, sliceLen);
}
开发者ID:Kinetic,项目名称:kinetic-c,代码行数:34,代码来源:test_byte_array.c

示例2: test_removeNextLargerSuccessor_given_nodes_1_4_5_6_7_8_10_13_15_20_should_remove_successor_1

/** Encounter case 3 on the left child after remove successor (with case 1a appear after rotate)
 *
 *      parent's left                      parent's left                   parent's left                        parent's left
 *            |                                  |                               |                                    |
 *            v                                  v                               v                                    v
 *          10(b)                              10(b)                           10(b)                                10(b)
 *       /         \       successor 1      /         \                      /        \                          /        \
 *     4(b)       15(b)   ------------>   4(b)       15(b)  ------------> 7(b)       15(b)   ------------>     7(b)       15(b)
 *    /   \       /   \                  //  \       /   \               /   \       /   \                    /   \       /   \
 *  1(b) 7(r)  13(b) 20(b)             NULL 7(r)  13(b) 20(b)          4(r) 8(b)  13(b) 20(b)               5(r) 8(b)  13(b) 20(b)
 *       /  \                               /  \                      //  \                                /   \
 *     5(b) 8(b)                          5(b) 8(b)                 NULL 5(b)                            4(b) 6(b)
 *        \                                  \                              \
 *       6(r)                               6(r)                           6(r)
 */
void test_removeNextLargerSuccessor_given_nodes_1_4_5_6_7_8_10_13_15_20_should_remove_successor_1(void)
{
    setNode(&node6, NULL, NULL, 'r');
    setNode(&node5, NULL, &node6, 'b');
    setNode(&node8, NULL, NULL, 'b');
    setNode(&node7, &node5, &node8, 'r');
    setNode(&node13, NULL, NULL, 'b');
    setNode(&node20, NULL, NULL, 'b');
    setNode(&node1, NULL, NULL, 'b');
    setNode(&node4, &node1, &node7, 'b');
    setNode(&node15, &node13, &node20, 'b');
    setNode(&node10, &node4, &node15, 'b');
    Node *parent = &node10, *removeNode;

    removeNode = removeNextLargerSuccessor(&parent);

    TEST_ASSERT_EQUAL_PTR(&node10, parent);
    TEST_ASSERT_EQUAL_PTR(&node1, removeNode);
    TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node4);
    TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node6);
    TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node8);
    TEST_ASSERT_EQUAL_NODE(&node4, &node6, 'r', &node5);
    TEST_ASSERT_EQUAL_NODE(&node5, &node8, 'b', &node7);
    TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node13);
    TEST_ASSERT_EQUAL_NODE(NULL, NULL, 'b', &node20);
    TEST_ASSERT_EQUAL_NODE(&node13, &node20, 'b', &node15);
    TEST_ASSERT_EQUAL_NODE(&node7, &node15, 'b', &node10);
}
开发者ID:banana93,项目名称:RedBlackTree,代码行数:43,代码来源:test_RedBlackTreeDel.c

示例3: test_getTruePapersFromListB_given_p3_p5_no_conflict_but_p4_has_should_take_out_p3_p5

/**  listA has p1 , p3 and p5 no conflict to listA
 *   studentNum in p3,p5 are 50, sum toggether are 100 , is within ratio of targetNum
 *   so will take out  p3 and p5
 * ****************************************************************   
 *  ( targetNum = 100 )
 *
 *  listA :    p1 
 *            c1, c2 
 *
 *  listB :    p3(50)           p4(50)       p5(50)                          
 *            c3, c4            c1,c2       c5,c6   
 *             *                              *                 
 * ---------------------OUTPUT----------------------------                            
 *                                
 *     truePapers = p5,p3 
 *      ListB = p4;
*/
void test_getTruePapersFromListB_given_p3_p5_no_conflict_but_p4_has_should_take_out_p3_p5(void){
  
  setPaperTakersNum(&p1 ,"p1", 50);
  addProgrammeToPaper(&p1, &c1);
  addProgrammeToPaper(&p1, &c2);
  
  setPaperTakersNum(&p3 ,"p3", 50);
  addProgrammeToPaper(&p3, &c3);
  addProgrammeToPaper(&p3, &c4);
 
  setPaperTakersNum(&p4 ,"p4", 50);
  addProgrammeToPaper(&p4, &c1);  
  addProgrammeToPaper(&p4, &c2);  
  
  setPaperTakersNum(&p5 ,"p3", 50);
  addProgrammeToPaper(&p5, &c5);
  addProgrammeToPaper(&p5, &c6);
  
  listA = linkListNew(&p1);
  
  listB = linkListNew(&p5);
  addDataToHead(&listB, &p4);
  addDataToHead(&listB, &p3);
  //--------------------------------THE ABOVE ARE THE ELEMENT INITIALIZATION---------------------------------------
  
  truePapers = getTruePapersFromListB(listA, listB, 100);
  TEST_ASSERT_EQUAL_PTR( &p5, TAKEN_PAPER1->data);
  TEST_ASSERT_EQUAL_PTR( &p3, TAKEN_PAPER2->data);
  TEST_ASSERT_NULL(TAKEN_PAPER3);
  CLEAR_ALL_LIST;
}
开发者ID:Raydivine,项目名称:ExamTimeTabling,代码行数:48,代码来源:test_getTruePapersFromListB.c

示例4: test_mutateTwoSession_given_the_2session_all_element_conflict_with_other_should_not_do_Mutation

/**  
 *                              
 *  Session1 :    p1              p2                              
 *               c1,c2           c3,c4                  
 *
 *  Session2 :    p3              p4                            
 *               c2,c3          c4,c1                
 * 
 *   Session1 and Session2 all elements are confict with each other, their programmes element already exist in other session, 
 *   so no matter how exchange will just only cause confict, therefore should not do mutation
*/
void test_mutateTwoSession_given_the_2session_all_element_conflict_with_other_should_not_do_Mutation(void){
  setPaperTakersNum(&p1, "p1", 50);
  addProgrammeToPaper(&p1, &c1);
  addProgrammeToPaper(&p1, &c2);
  
  setPaperTakersNum(&p2, "p2", 50);
  addProgrammeToPaper(&p2, &c3);
  addProgrammeToPaper(&p2, &c4);
  
  setPaperTakersNum(&p3, "p3", 50);
  addProgrammeToPaper(&p3, &c2);
  addProgrammeToPaper(&p3, &c3);
  
  setPaperTakersNum(&p4, "p4", 50);
  addProgrammeToPaper(&p4, &c4);  
  addProgrammeToPaper(&p4, &c1);  
  

  addPaperToSession(&s1, &p2);
  addPaperToSession(&s1, &p1);
  
  addPaperToSession(&s2, &p4);
  addPaperToSession(&s2, &p3);
  //----------------------------------------------------------------------------------------
  mutateTwoSession(&s1, &s2);
  TEST_ASSERT_EQUAL_PTR( &p1,S1_HEAD->data);
  TEST_ASSERT_EQUAL_PTR( &p2,S1_HEAD1->data);
  TEST_ASSERT_NULL(S1_HEAD2);
  TEST_ASSERT_EQUAL_PTR( &p3,S2_HEAD->data);
  TEST_ASSERT_EQUAL_PTR( &p4,S2_HEAD1->data);
  TEST_ASSERT_NULL(S2_HEAD2);
  
  CLEAR_ALL_LIST;
}
开发者ID:Raydivine,项目名称:ExamTimeTabling,代码行数:45,代码来源:test_mutateTwoSession0.c

示例5: test_createdXorModule_given_TRI_3_INPUT_type_should_create_module_for_XOR_gate

void test_createdXorModule_given_TRI_3_INPUT_type_should_create_module_for_XOR_gate(void)
{
    Module *XOR;
    int i, inputType = TRI_3_INPUT;

    XOR = createdXorModule(inputType);

    TEST_ASSERT_NOT_NULL(XOR);
    TEST_ASSERT_EQUAL_STRING("XOR", XOR->name);
    TEST_ASSERT_EQUAL_PTR(&xorEvent, XOR->event);
    TEST_ASSERT_EQUAL_PTR(&setXor, XOR->set);
    TEST_ASSERT_EQUAL_PTR(&configureInputOutput, XOR->configure);
    TEST_ASSERT_EQUAL(inputType, XOR->typeOfInput);
    TEST_ASSERT_EQUAL(TOTAL_PIN, XOR->totalPin);

    for(i = 0; i < TOTAL_PIN; i++)
    {
        if(i < 9)
            TEST_ASSERT_EQUAL(INPUT_PIN, (XOR->pin[i]).type);
        else if(i > 8 && i < 12)
            TEST_ASSERT_EQUAL(OUTPUT_PIN, (XOR->pin[i]).type);
        else
            TEST_ASSERT_EQUAL(UNUSED_PIN, (XOR->pin[i]).type);

        TEST_ASSERT_EQUAL(i, (XOR->pin[i]).pinNumber);
        TEST_ASSERT_EQUAL(LOW, (XOR->pin[i]).state);
        TEST_ASSERT_EQUAL_PTR(NULL, (XOR->pin[i]).pipe);
    }

    destroyModule(XOR);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:31,代码来源:test_DigitalSignalModule.c

示例6: test_createdNotModule_given_HEX_INV_type_should_create_module_for_NOT_gate

void test_createdNotModule_given_HEX_INV_type_should_create_module_for_NOT_gate(void)
{
    Module *NOT;
    int i, inputType = HEX_INV;

    NOT = createdNotModule(inputType);

    TEST_ASSERT_NOT_NULL(NOT);
    TEST_ASSERT_EQUAL_STRING("NOT", NOT->name);
    TEST_ASSERT_EQUAL_PTR(&notEvent, NOT->event);
    TEST_ASSERT_EQUAL_PTR(&setNot, NOT->set);
    TEST_ASSERT_EQUAL_PTR(&configureInputOutput, NOT->configure);
    TEST_ASSERT_EQUAL(inputType, NOT->typeOfInput);
    TEST_ASSERT_EQUAL(TOTAL_PIN, NOT->totalPin);

    for(i = 0; i < TOTAL_PIN; i++)
    {
        if(i < 6)
            TEST_ASSERT_EQUAL(INPUT_PIN, (NOT->pin[i]).type);
        else if(i > 5 && i < 12)
            TEST_ASSERT_EQUAL(OUTPUT_PIN, (NOT->pin[i]).type);
        else
            TEST_ASSERT_EQUAL(UNUSED_PIN, (NOT->pin[i]).type);

        TEST_ASSERT_EQUAL(i, (NOT->pin[i]).pinNumber);
        TEST_ASSERT_EQUAL(LOW, (NOT->pin[i]).state);
        TEST_ASSERT_EQUAL_PTR(NULL, (NOT->pin[i]).pipe);
    }

    destroyModule(NOT);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:31,代码来源:test_DigitalSignalModule.c

示例7: test_createdNorModule_given_DUAL_4_INPUT_type_should_create_module_for_MOR_gate

void test_createdNorModule_given_DUAL_4_INPUT_type_should_create_module_for_MOR_gate(void)
{
    Module *NOR;
    int i, inputType = DUAL_4_INPUT;

    NOR = createdNorModule(inputType);

    TEST_ASSERT_NOT_NULL(NOR);
    TEST_ASSERT_EQUAL_STRING("NOR", NOR->name);
    TEST_ASSERT_EQUAL_PTR(&norEvent, NOR->event);
    TEST_ASSERT_EQUAL_PTR(&setNor, NOR->set);
    TEST_ASSERT_EQUAL_PTR(&configureInputOutput, NOR->configure);
    TEST_ASSERT_EQUAL(inputType, NOR->typeOfInput);
    TEST_ASSERT_EQUAL(TOTAL_PIN, NOR->totalPin);

    for(i = 0; i < TOTAL_PIN; i++)
    {
        if(i < 8)
            TEST_ASSERT_EQUAL(INPUT_PIN, (NOR->pin[i]).type);
        else if(i > 7 && i < 10)
            TEST_ASSERT_EQUAL(OUTPUT_PIN, (NOR->pin[i]).type);
        else
            TEST_ASSERT_EQUAL(UNUSED_PIN, (NOR->pin[i]).type);

        TEST_ASSERT_EQUAL(i, (NOR->pin[i]).pinNumber);
        TEST_ASSERT_EQUAL(LOW, (NOR->pin[i]).state);
        TEST_ASSERT_EQUAL_PTR(NULL, (NOR->pin[i]).pipe);
    }

    destroyModule(NOR);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:31,代码来源:test_DigitalSignalModule.c

示例8: test_createdNandModule_given_TRI_3_INPUT_type_should_create_module_for_NAND_gate

void test_createdNandModule_given_TRI_3_INPUT_type_should_create_module_for_NAND_gate(void)
{
    Module *NAND;
    int i, inputType = TRI_3_INPUT;

    NAND = createdNandModule(inputType);

    TEST_ASSERT_NOT_NULL(NAND);
    TEST_ASSERT_EQUAL_STRING("NAND", NAND->name);
    TEST_ASSERT_EQUAL_PTR(&nandEvent, NAND->event);
    TEST_ASSERT_EQUAL_PTR(&setNand, NAND->set);
    TEST_ASSERT_EQUAL_PTR(&configureInputOutput, NAND->configure);
    TEST_ASSERT_EQUAL(inputType, NAND->typeOfInput);
    TEST_ASSERT_EQUAL(TOTAL_PIN, NAND->totalPin);

    for(i = 0; i < TOTAL_PIN; i++)
    {
        if(i < 9)
            TEST_ASSERT_EQUAL(INPUT_PIN, (NAND->pin[i]).type);
        else if(i > 8 && i < 12)
            TEST_ASSERT_EQUAL(OUTPUT_PIN, (NAND->pin[i]).type);
        else
            TEST_ASSERT_EQUAL(UNUSED_PIN, (NAND->pin[i]).type);

        TEST_ASSERT_EQUAL(i, (NAND->pin[i]).pinNumber);
        TEST_ASSERT_EQUAL(LOW, (NAND->pin[i]).state);
        TEST_ASSERT_EQUAL_PTR(NULL, (NAND->pin[i]).pipe);
    }

    destroyModule(NAND);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:31,代码来源:test_DigitalSignalModule.c

示例9: test_createdAndModule_given_DUAL_4_INPUT_type_should_create_module_for_AND_gate

void test_createdAndModule_given_DUAL_4_INPUT_type_should_create_module_for_AND_gate(void)
{
    Module *AND;
    int i, inputType = DUAL_4_INPUT;

    AND = createdAndModule(inputType);

    TEST_ASSERT_NOT_NULL(AND);
    TEST_ASSERT_EQUAL_STRING("AND", AND->name);
    TEST_ASSERT_EQUAL_PTR(&andEvent, AND->event);
    TEST_ASSERT_EQUAL_PTR(&setAnd, AND->set);
    TEST_ASSERT_EQUAL_PTR(&configureInputOutput, AND->configure);
    TEST_ASSERT_EQUAL(inputType, AND->typeOfInput);
    TEST_ASSERT_EQUAL(TOTAL_PIN, AND->totalPin);

    for(i = 0; i < TOTAL_PIN; i++)
    {
        if(i < 8)
            TEST_ASSERT_EQUAL(INPUT_PIN, (AND->pin[i]).type);
        else if(i > 7 && i < 10)
            TEST_ASSERT_EQUAL(OUTPUT_PIN, (AND->pin[i]).type);
        else
            TEST_ASSERT_EQUAL(UNUSED_PIN, (AND->pin[i]).type);

        TEST_ASSERT_EQUAL(i, (AND->pin[i]).pinNumber);
        TEST_ASSERT_EQUAL(LOW, (AND->pin[i]).state);
        TEST_ASSERT_EQUAL_PTR(NULL, (AND->pin[i]).pipe);
    }

    destroyModule(AND);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:31,代码来源:test_DigitalSignalModule.c

示例10: setPaperTakersNum

/**  
 *                              
 *  Session1 :    p1              p2(100)                              
 *               c1,c2           c5,c6                  
 *                                 *
 *
 *  Session2 :    p3(10)           p4(10)                            
 *               c7,c8           c9,c10                
 * 
 *    
 *   p2 is no confict to session2, but session2 can not return a papers combo having close number to p2, so do nothing
*/
void test_mutateTwoSession_given_the_session2_cannot_return_papers_combo_having_close_number_to_p2_should_do_nothing(void){
  setPaperTakersNum(&p1, "p1", 50);
  addProgrammeToPaper(&p1, &c1);
  addProgrammeToPaper(&p1, &c2);
  
  setPaperTakersNum(&p2, "p2", 100);
  addProgrammeToPaper(&p2, &c5);
  addProgrammeToPaper(&p2, &c6);
  
  setPaperTakersNum(&p3, "p3", 10);
  addProgrammeToPaper(&p3, &c7);
  addProgrammeToPaper(&p3, &c8);
  
  setPaperTakersNum(&p4, "p4", 10);
  addProgrammeToPaper(&p4, &c9);  
  addProgrammeToPaper(&p4, &c10);  
  
  addPaperToSession(&s1, &p2);
  addPaperToSession(&s1, &p1);
  
  addPaperToSession(&s2, &p4);
  addPaperToSession(&s2, &p3);
  //----------------------------------------------------------------------------------------
  mutateTwoSession(&s1, &s2);
  TEST_ASSERT_EQUAL_PTR( &p1,S1_HEAD->data);
  TEST_ASSERT_EQUAL_PTR( &p2,S1_HEAD1->data);
  TEST_ASSERT_NULL(S1_HEAD2);
  TEST_ASSERT_EQUAL_PTR( &p3,S2_HEAD->data);
  TEST_ASSERT_EQUAL_PTR( &p4,S2_HEAD1->data);
  TEST_ASSERT_NULL(S2_HEAD2);
  
  CLEAR_ALL_LIST;
}
开发者ID:Raydivine,项目名称:ExamTimeTabling,代码行数:45,代码来源:test_mutateTwoSession0.c

示例11: test_mutateTwoSession_given_the_p3_p4_having_c8_cause_conflict_so_do_nothing

/**  
 *                              
 *  Session1 :    p1              p2(100)                              
 *               c1,c2           c5,c6                  
 *                                 *
 *
 *  Session2 :    p3(50)           p4(50)                            
 *               c7,c8           c8,c1                
 *                   
 *    (p3 and p4 having c8 )
 *   p2 is no confict to session2, p3 and p4 together can meet p2 studentNum, but p3 p4 them selves has confict, so do nothing
*/
void test_mutateTwoSession_given_the_p3_p4_having_c8_cause_conflict_so_do_nothing(void){
  setPaperTakersNum(&p1, "p1", 50);
  addProgrammeToPaper(&p1, &c1);
  addProgrammeToPaper(&p1, &c2);
  
  setPaperTakersNum(&p2, "p2", 100);
  addProgrammeToPaper(&p2, &c5);
  addProgrammeToPaper(&p2, &c6);
  
  setPaperTakersNum(&p3, "p3", 50);
  addProgrammeToPaper(&p3, &c7);
  addProgrammeToPaper(&p3, &c8);
  
  setPaperTakersNum(&p4, "p4", 50);
  addProgrammeToPaper(&p4, &c8);  
  addProgrammeToPaper(&p4, &c1);  
  
  addPaperToSession(&s1, &p2);
  addPaperToSession(&s1, &p1);
  
  addPaperToSession(&s2, &p4);
  addPaperToSession(&s2, &p3);
  //----------------------------------------------------------------------------------------
  mutateTwoSession(&s1, &s2);
  TEST_ASSERT_EQUAL_PTR( &p1,S1_HEAD->data);
  TEST_ASSERT_EQUAL_PTR( &p2,S1_HEAD1->data);
  TEST_ASSERT_NULL(S1_HEAD2);
  TEST_ASSERT_EQUAL_PTR( &p3,S2_HEAD->data);
  TEST_ASSERT_EQUAL_PTR( &p4,S2_HEAD1->data);
  TEST_ASSERT_NULL(S2_HEAD2);
  
  CLEAR_ALL_LIST;
}
开发者ID:Raydivine,项目名称:ExamTimeTabling,代码行数:45,代码来源:test_mutateTwoSession0.c

示例12: test_createdOrModule_given_QUAD_2_INPUT_type_should_create_module_for_OR_gate

void test_createdOrModule_given_QUAD_2_INPUT_type_should_create_module_for_OR_gate(void)
{
    Module *OR;
    int i, inputType = QUAD_2_INPUT;

    OR = createdOrModule(inputType);

    TEST_ASSERT_NOT_NULL(OR);
    TEST_ASSERT_EQUAL_STRING("OR", OR->name);
    TEST_ASSERT_EQUAL_PTR(&orEvent, OR->event);
    TEST_ASSERT_EQUAL_PTR(&setOr, OR->set);
    TEST_ASSERT_EQUAL_PTR(&configureInputOutput, OR->configure);
    TEST_ASSERT_EQUAL(inputType, OR->typeOfInput);
    TEST_ASSERT_EQUAL(TOTAL_PIN, OR->totalPin);

    for(i = 0; i < TOTAL_PIN; i++)
    {
        if(i < 8)
            TEST_ASSERT_EQUAL(INPUT_PIN, (OR->pin[i]).type);
        else if(i > 7 && i < 12)
            TEST_ASSERT_EQUAL(OUTPUT_PIN, (OR->pin[i]).type);
        else
            TEST_ASSERT_EQUAL(UNUSED_PIN, (OR->pin[i]).type);

        TEST_ASSERT_EQUAL(i, (OR->pin[i]).pinNumber);
        TEST_ASSERT_EQUAL(LOW, (OR->pin[i]).state);
        TEST_ASSERT_EQUAL_PTR(NULL, (OR->pin[i]).pipe);
    }

    destroyModule(OR);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:31,代码来源:test_DigitalSignalModule.c

示例13: createdOrModule

void test_configureInputOutput_given_AND_and_OR_that_connected_to_pipe_should_connect_output_from_pipe_to_AND_module_and_add_data_to_pipe(void)
{
    Module *AND, *OR;
    Pipe *pipe;
    ModuleAndPin *moduleAndPin;
    int inputType = QUAD_2_INPUT;

    OR = createdOrModule(inputType);
    AND = createdAndModule(inputType);
    pipe = createdPipeModule();
    (OR->pin[9]).pipe = pipe;

    OR->configure((void *)OR, (void *)&OR->pin[9], (void *)AND, (void *)&AND->pin[0]);
    moduleAndPin = (OR->pin[9]).pipe->data->dataPtr;

    TEST_ASSERT_NOT_NULL(AND);
    TEST_ASSERT_NOT_NULL(OR);
    TEST_ASSERT_NOT_NULL((OR->pin[9]).pipe);
    TEST_ASSERT_EQUAL_PTR((OR->pin[9]).pipe, (AND->pin[0]).pipe);
    TEST_ASSERT_EQUAL_PTR(AND, moduleAndPin->module);
    TEST_ASSERT_EQUAL_PTR(&AND->pin[0], moduleAndPin->pin);

    destroyModule(AND);
    destroyModule(OR);
}
开发者ID:JacksonTeh,项目名称:DigitalLogicSimulator,代码行数:25,代码来源:test_DigitalSignalModule.c

示例14: test_add_SHOULD_NOT_ADD_IF_BUFFER_IS_FULL

void test_add_SHOULD_NOT_ADD_IF_BUFFER_IS_FULL()
{
	CircularBuffer *CB = CreateBuffer(SIZE_OF_BUFFER);
	CB->length = CB-> size;
	CB ->buffer[0] = NUMBER+1;   //Fake the original number.
	add(CB,NUMBER);
	//The number in slot 0 still be the same
	TEST_ASSERT_EQUAL( NUMBER+1, CB->buffer[0]);
	// Add should fail to size buffer is full (0 indicates failures)
	TEST_ASSERT_EQUAL(0,add(CB,NUMBER));

	CB=CreateBuffer(SIZE_OF_BUFFER);
	add(CB,1);
	add(CB,2);
	add(CB,3);
	add(CB,4);
	add(CB,5);

	//Add should fail size buffer is full (0indicates failures)
	TEST_ASSERT_EQUAL(0,add(CB,6));
	TEST_ASSERT_EQUAL(1,CB->buffer[0]);
	TEST_ASSERT_EQUAL(2,CB->buffer[1]);
	TEST_ASSERT_EQUAL(3,CB->buffer[2]);
	TEST_ASSERT_EQUAL(4,CB->buffer[3]);
	TEST_ASSERT_EQUAL(5,CB->buffer[4]);
	TEST_ASSERT_EQUAL_PTR(&(CB->buffer[0]),CB->head);
	TEST_ASSERT_EQUAL_PTR(CB->tail,CB->head);
}
开发者ID:jwchong93,项目名称:Circular-Buffer,代码行数:28,代码来源:test_CircularBuffer.c

示例15: test_KineticBuilder_BuildSetPin_should_build_a_SECURITY_operation_to_set_new_ERASE_PIN

void test_KineticBuilder_BuildSetPin_should_build_a_SECURITY_operation_to_set_new_ERASE_PIN(void)
{
    char oldPinData[] = "1234";
    char newPinData[] = "5678";
    ByteArray oldPin = ByteArray_Create(oldPinData, sizeof(oldPinData));
    ByteArray newPin = ByteArray_Create(newPinData, sizeof(newPinData));

    KineticOperation_ValidateOperation_Expect(&Operation);

    KineticBuilder_BuildSetPin(&Operation, oldPin, newPin, false);

    TEST_ASSERT_FALSE(Request.pinAuth);
    TEST_ASSERT_EQUAL(KineticOperation_TimeoutSetPin, Operation.timeoutSeconds);
    TEST_ASSERT_TRUE(Request.message.command.header->has_messagetype);
    TEST_ASSERT_EQUAL(COM__SEAGATE__KINETIC__PROTO__COMMAND__MESSAGE_TYPE__SECURITY,
        Request.message.command.header->messagetype);
    TEST_ASSERT_EQUAL_PTR(&Request.message.body, Request.command->body);
    TEST_ASSERT_EQUAL_PTR(&Request.message.security, Request.command->body->security);
    TEST_ASSERT_TRUE(Request.command->body->security->has_olderasepin);
    TEST_ASSERT_EQUAL_PTR(oldPinData, Request.command->body->security->olderasepin.data);
    TEST_ASSERT_EQUAL(oldPin.len, Request.command->body->security->olderasepin.len);
    TEST_ASSERT_TRUE(Request.command->body->security->has_newerasepin);
    TEST_ASSERT_EQUAL_PTR(newPinData, Request.command->body->security->newerasepin.data);
    TEST_ASSERT_EQUAL(newPin.len, Request.command->body->security->newerasepin.len);
    TEST_ASSERT_NULL(Request.command->body->pinop);
    TEST_ASSERT_EQUAL_PTR(&KineticCallbacks_Basic, Operation.opCallback);
    TEST_ASSERT_NULL(Operation.response);
}
开发者ID:chenchongli,项目名称:kinetic-c,代码行数:28,代码来源:test_kinetic_builder.c


注:本文中的TEST_ASSERT_EQUAL_PTR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。