Navigation


Changeset 778:003df4a9ade2 in freeDiameter for tests


Ignore:
Timestamp:
Jan 22, 2012, 12:11:34 AM (12 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added two new interfaces on Zach requests http://lists.freediameter.net/pipermail/help/2012-January/000312.html and http://lists.freediameter.net/pipermail/help/2012-January/000311.html

Location:
tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/testdict.c

    r770 r778  
    166166        }
    167167
     168        /* Test delete function */
     169        {
     170                struct fd_list * li = NULL;
     171                struct fd_list * sentinel = NULL;
     172                struct dict_object * obj=NULL;
     173                vendor_id_t vid = 0;
     174                int count = 0, cntbkp;
     175               
     176                CHECK( 0, fd_dict_search(fd_g_config->cnf_dict, DICT_VENDOR, VENDOR_BY_ID, &vid, &obj, ENOENT) );
     177               
     178                CHECK( EINVAL, fd_dict_delete(obj) );
     179                       
     180               
     181                CHECK( 0, fd_dict_getlistof(AVP_BY_NAME, obj, &sentinel));
     182                obj = NULL;
     183               
     184                for (li = sentinel->next; li != sentinel; li = li->next) {
     185                        struct dict_avp_data data;
     186                        CHECK( 0, fd_dict_getval(li->o, &data) );
     187                        count++;
     188                        if (data.avp_basetype != AVP_TYPE_GROUPED)
     189                                obj = li->o;
     190                }
     191               
     192                CHECK(1, obj ? 1 : 0 );
     193#if 1
     194                fd_dict_dump_object(obj);
     195#endif
     196                CHECK( 0, fd_dict_delete(obj) );
     197                cntbkp = count;
     198                count = 0;
     199                for (li = sentinel->next; li != sentinel; li = li->next) {
     200                        count++;
     201                }
     202                CHECK( 1, cntbkp - count );
     203               
     204        }
     205       
    168206        /* That's all for the tests yet */
    169207        PASSTEST();
  • tests/testsess.c

    r740 r778  
    174174                CHECK( 0, fd_sess_destroy( &sess1 ) );
    175175        }
     176       
     177        /* Test fd_sess_getcount */
     178        {
     179                uint32_t cnt;
     180                CHECK( 0, fd_sess_new( &sess1, TEST_DIAM_ID, CONSTSTRLEN(TEST_DIAM_ID), NULL, 0 ) );
     181                CHECK( 0, fd_sess_new( &sess2, TEST_DIAM_ID, CONSTSTRLEN(TEST_DIAM_ID), NULL, 0 ) );
     182                CHECK( 0, fd_sess_getcount(&cnt));
     183                CHECK( 2, cnt);
     184                CHECK( 0, fd_sess_destroy( &sess2 ) );
     185                CHECK( 0, fd_sess_getcount(&cnt));
     186                CHECK( 1, cnt);
     187                CHECK( 0, fd_sess_destroy( &sess1 ) );
     188                CHECK( 0, fd_sess_getcount(&cnt));
     189                CHECK( 0, cnt);
     190               
     191        }
    176192               
    177193        /* Test fd_sess_fromsid */
Note: See TracChangeset for help on using the changeset viewer.