Navigation


Changeset 769:99136ec7d9d4 in freeDiameter for tests


Ignore:
Timestamp:
Oct 26, 2011, 4:48:52 AM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fixed fd_dict_getlistof function, added a simple test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/testdict.c

    r740 r769  
    129129                CHECK( 2, nbr );
    130130        }
     131       
     132        /* Test list function */
     133        {
     134                struct fd_list * li = NULL;
     135                struct fd_list * sentinel = NULL;
     136                enum dict_object_type   type;
     137                struct dict_object * defvnd=NULL;
     138                vendor_id_t vid = 0;
     139               
     140                CHECK( 0, fd_dict_getlistof(VENDOR_BY_ID, fd_g_config->cnf_dict, &sentinel));
     141               
     142                for (li = sentinel->next; li != sentinel; li = li->next) {
     143                        CHECK(0, fd_dict_gettype(li->o, &type));
     144                        CHECK(DICT_VENDOR, type);
     145                }
     146               
     147                CHECK( 0, fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_ID, &vid, &defvnd, ENOENT) );
     148               
     149                CHECK( 0, fd_dict_getlistof(AVP_BY_NAME, defvnd, &sentinel));
     150                for (li = sentinel->next; li != sentinel; li = li->next) {
     151                        CHECK(0, fd_dict_gettype(li->o, &type));
     152                        CHECK(DICT_AVP, type);
     153#if 0
     154                        struct dict_avp_data data;
     155                        CHECK( 0, fd_dict_getval(li->o, &data) );
     156                        printf("%d : %s\n", data.avp_code, data.avp_name);
     157#endif
     158                }
     159        }
    131160
    132161        /* That's all for the tests yet */
Note: See TracChangeset for help on using the changeset viewer.