LCOV - code coverage report
Current view: top level - test - arraylisttest.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 24 24 100.0 %
Date: 2015-05-24 18:28:16 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /***************************************************************************//**
       2             : 
       3             :   @file         arraylisttest.c
       4             : 
       5             :   @author       Stephen Brennan
       6             : 
       7             :   @date         Created Saturday, 28 September 2013
       8             : 
       9             :   @brief        Test of the array list data structure.
      10             : 
      11             :   @copyright    Copyright (c) 2013-2015, Stephen Brennan.  Released under the
      12             :                 Revised BSD License.  See the LICENSE.txt file for details.
      13             : 
      14             : *******************************************************************************/
      15             : 
      16             : #include "libstephen/al.h"
      17             : #include "libstephen/ut.h"
      18             : #include "tests.h"
      19             : 
      20             : ////////////////////////////////////////////////////////////////////////////////
      21             : // TESTS
      22             : 
      23           1 : int al_test_create()
      24             : {
      25             :   DATA d;
      26           1 :   smb_status status = SMB_SUCCESS;
      27           1 :   d.data_llint = 13;
      28             : 
      29           1 :   smb_al *list = al_create();
      30           1 :   al_append(list, d);
      31             : 
      32           1 :   TEST_ASSERT(al_length(list) == 1);
      33             : 
      34           1 :   TEST_ASSERT(al_get(list, 0, &status).data_llint == 13);
      35           1 :   TEST_ASSERT(status == SMB_SUCCESS);
      36             : 
      37           1 :   al_delete(list);
      38           1 :   return 0;
      39             : }
      40             : 
      41           1 : int al_test_create_empty()
      42             : {
      43           1 :   smb_al *list = al_create();
      44           1 :   TEST_ASSERT(al_length(list) == 0);
      45           1 :   al_delete(list);
      46           1 :   return 0;
      47             : }
      48             : 
      49             : 
      50             : ////////////////////////////////////////////////////////////////////////////////
      51             : // TEST LOADER AND RUNNER
      52             : 
      53           1 : void array_list_test()
      54             : {
      55           1 :   smb_ut_group *group = su_create_test_group("array list");
      56             : 
      57           1 :   smb_ut_test *create = su_create_test("create", al_test_create);
      58           1 :   su_add_test(group, create);
      59             : 
      60           1 :   smb_ut_test *create_empty = su_create_test("create_empty", al_test_create_empty);
      61           1 :   su_add_test(group, create_empty);
      62             : 
      63           1 :   su_run_group(group);
      64           1 :   su_delete_group(group);
      65           1 : }

Generated by: LCOV version 1.11