X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=test%2Fsymtab_test.c;h=b755e9c255921e0f66c6916a26cfbd12a3b2008e;hb=2596b2305f214efbd7aba832fa009217ab854770;hp=e2efa2badc322c32f11f57bc81be5a8e1382c09f;hpb=d710957ed5d73bf2da2ceea3f5a1a3c509275c30;p=ric-plt%2Flib%2Frmr.git diff --git a/test/symtab_test.c b/test/symtab_test.c index e2efa2b..b755e9c 100644 --- a/test/symtab_test.c +++ b/test/symtab_test.c @@ -1,13 +1,13 @@ /* ================================================================================== - Copyright (c) 2019 Nokia - Copyright (c) 2018-2019 AT&T Intellectual Property. + Copyright (c) 2019 Nokia + Copyright (c) 2018-2019 AT&T Intellectual Property. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -21,7 +21,7 @@ /* Mnemonic: symtab_test.c Abstract: This is the unit test module that will drive tests against - the symbol table portion of RMr. Run with: + the symbol table portion of RMr. Run with: ksh unit_test.ksh symtab_test.c Date: 1 April 2019 Author: E. Scott Daniels @@ -29,8 +29,8 @@ #define NO_DUMMY_RMR 1 // no dummy rmr functions; we don't pull in rmr.h or agnostic.h -#include "../src/common/include/rmr_symtab.h" -#include "../src/common/src/symtab.c" +#include "rmr_symtab.h" +#include "symtab.c" #include "test_support.c" @@ -48,7 +48,7 @@ static void fetch( void* st, char* key, int class, int expected ) { if( !expected ) { state = BAD; } - + } else { fprintf( stderr, "[%s] string key fetch return nil\n", expected ? "FAIL" : "OK" ); if( expected ) { @@ -83,36 +83,36 @@ static void each_counter( void* a, void* b, const char* c, void* d, void* e ) { } int main( ) { - void* st; - char* foo = "foo"; - char* bar = "bar"; + void* st; + char* foo = "foo"; + char* bar = "bar"; char* goo = "goo"; // name not in symtab int i; int class = 1; int s; void* p; - st = rmr_sym_alloc( 10 ); // alloc with small value to force adjustment inside + st = rmr_sym_alloc( 10 ); // alloc with small value to force adjustment inside fail_if_nil( st, "symtab pointer" ); - s = rmr_sym_put( st, foo, class, bar ); // add entry with string key; returns 1 if it was inserted + s = rmr_sym_put( st, foo, class, bar ); // add entry with string key; returns 1 if it was inserted fail_if_false( s, "insert foo existed" ); - s = rmr_sym_put( st, foo, class+1, bar ); // add to table with a different class + s = rmr_sym_put( st, foo, class+1, bar ); // add to table with a different class fail_if_false( s, "insert foo existed" ); - s = rmr_sym_put( st, foo, class, bar ); // inserted above, should return not inserted (0) + s = rmr_sym_put( st, foo, class, bar ); // inserted above, should return not inserted (0) fail_if_true( s, "insert foo existed" ); fetch( st, foo, class, 1 ); fetch( st, goo, class, 0 ); // fetch non existant - rmr_sym_stats( st, 4 ); // early stats at verbose level 4 so chatter is minimised + rmr_sym_stats( st, 4 ); // early stats at verbose level 4 so chatter is minimised rmr_sym_dump( st ); for( i = 2000; i < 3000; i++ ) { // bunch of dummy things to force chains in the table rmr_sym_map( st, i, foo ); // add entry with unsigned integer key } - rmr_sym_stats( st, 0 ); // just the small facts to verify the 1000 we stuffed in + rmr_sym_stats( st, 0 ); // just the small facts to verify the 1000 we stuffed in rmr_sym_ndel( st, 2001 ); // force a numeric key delete rmr_sym_ndel( st, 12001 ); // delete numeric key not there @@ -129,13 +129,13 @@ int main( ) { nfetch( st, 2345, 1 ); - rmr_sym_del( st, foo, 0 ); + rmr_sym_del( st, foo, 0 ); - rmr_sym_stats( st, 0 ); + rmr_sym_stats( st, 0 ); rmr_sym_free( NULL ); // ensure it doesn't barf when given a nil pointer rmr_sym_free( st ); - return state; + return state; }