这篇教程C++ srcdir_file函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中srcdir_file函数的典型用法代码示例。如果您正苦于以下问题:C++ srcdir_file函数的具体用法?C++ srcdir_file怎么用?C++ srcdir_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了srcdir_file函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: testreadwritecomplicatedstatic void testreadwritecomplicated (const char * file){ Key * parentKey = keyNew ("user/tests/csvstorage", KEY_VALUE, srcdir_file (file), KEY_END); KeySet * conf = ksNew (10, keyNew ("system/delimiter", KEY_VALUE, ";", KEY_END), keyNew ("system/header", KEY_VALUE, "colname", KEY_END), KS_END); KeySet * ks = ksNew (0, KS_END); PLUGIN_OPEN ("csvstorage"); succeed_if (plugin->kdbGet (plugin, ks, parentKey) > 0, "call to kdbGet was not successful"); succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#1/col3", KDB_O_NONE)), "l1;c3"), "key value doesn't match expected value"); succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#1/col4", KDB_O_NONE)), "l1/"/"c4"), "key value doesn't match expected value"); succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#2/col3", KDB_O_NONE)), "l2/nc3"), "key value doesn't match expected value"); succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#4/col4", KDB_O_NONE)), "l4/"/"c4"), "key value doesn't match expected value"); succeed_if (!strcmp (keyString (ksLookupByName (ks, "user/tests/csvstorage/#5/col3", KDB_O_NONE)), "l5/"/"/nc3"), "key value doesn't match expected value"); keySetString (parentKey, elektraFilename ()); succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 0, "error: wrote invalid data"); succeed_if (compare_line_files (srcdir_file (file), keyString (parentKey)), "files do not match as expected"); ksDel (ks); keyDel (parentKey); PLUGIN_CLOSE ();}
开发者ID:reox,项目名称:libelektra,代码行数:27,
示例2: test_two_scripts// test loading lua twicestatic void test_two_scripts (void){ printf ("Testing loading of two active lua plugins.../n"); KeySet * modules = ksNew (0, KS_END); elektraModulesInit (modules, 0); KeySet * conf = ksNew (2, keyNew ("user/script", KEY_VALUE, srcdir_file ("lua/lua_plugin.lua"), KEY_END), keyNew ("user/print", KEY_END), KS_END); KeySet * conf2 = ksNew (2, keyNew ("user/script", KEY_VALUE, srcdir_file ("lua/lua_plugin2.lua"), KEY_END), keyNew ("user/print", KEY_END), KS_END); Key * errorKey = keyNew ("", KEY_END); Plugin * plugin = elektraPluginOpen ("lua", modules, conf, errorKey); succeed_if (output_warnings (errorKey), "warnings in kdbOpen"); succeed_if (output_error (errorKey), "errors in kdbOpen"); exit_if_fail (plugin != NULL, "unable to load lua plugin"); keyDel (errorKey); Key * errorKey2 = keyNew ("", KEY_END); Plugin * plugin2 = elektraPluginOpen ("lua", modules, conf2, errorKey2); succeed_if (output_warnings (errorKey2), "warnings in kdbOpen"); succeed_if (output_error (errorKey2), "errors in kdbOpen"); exit_if_fail (plugin2 != NULL, "unable to load lua plugin again"); keyDel (errorKey2); elektraPluginClose (plugin2, 0); elektraPluginClose (plugin, 0); elektraModulesClose (modules, 0); ksDel (modules);}
开发者ID:reox,项目名称:libelektra,代码行数:33,
示例3: test_readWritevoid test_readWrite (const char * fileName, KeySet * conf){ printf ("Test read write with %s/n", srcdir_file (fileName)); Plugin * plugin = elektraPluginOpen ("yajl", modules, conf, 0); exit_if_fail (plugin != 0, "could not open plugin"); // printf ("Test with %s/n", srcdir_file(fileName)); Key * parentKey = keyNew ("user/tests/yajl", KEY_VALUE, srcdir_file (fileName), KEY_END); KeySet * keys = ksNew (0, KS_END); succeed_if (plugin->kdbGet (plugin, keys, parentKey) == 1, "kdbGet was not successful"); succeed_if (output_error (parentKey), "error in kdbGet"); succeed_if (output_warnings (parentKey), "warnings in kdbGet"); // output_keyset(keys); keySetString (parentKey, elektraFilename ()); // keySetString(parentKey, "/proc/self/fd/1"); // printf("File name is: %s/n", keyString(parentKey)); succeed_if (plugin->kdbSet (plugin, keys, parentKey) == 1, "kdbSet was not successful"); succeed_if (output_error (parentKey), "error in kdbSet"); succeed_if (output_warnings (parentKey), "warnings in kdbSet"); succeed_if (compare_line_files (srcdir_file (fileName), keyString (parentKey)), "files do not match as expected"); elektraUnlink (keyString (parentKey)); keyDel (parentKey); ksDel (keys); elektraPluginClose (plugin, 0);}
开发者ID:reox,项目名称:libelektra,代码行数:32,
示例4: test_hostLensFormattingvoid test_hostLensFormatting(char *fileName){ Key *parentKey = keyNew ("user/tests/augeas-hosts", KEY_VALUE, srcdir_file (fileName), KEY_END); KeySet *conf = ksNew (20, keyNew ("system/lens", KEY_VALUE, "Hosts.lns", KEY_END), KS_END); PLUGIN_OPEN("augeas"); KeySet *ks = ksNew(0, KS_END); succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful"); succeed_if(output_error (parentKey), "error in kdbGet"); succeed_if(output_warnings (parentKey), "warnings in kdbGet"); keySetString (parentKey, elektraFilename()); succeed_if(plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful"); succeed_if(output_error (parentKey), "error in kdbSet"); succeed_if(output_warnings (parentKey), "warnings in kdbSet"); succeed_if( compare_line_files (srcdir_file (fileName), keyString (parentKey)), "files do not match as expected"); elektraUnlink(keyString (parentKey)); keyDel (parentKey); ksDel (ks); PLUGIN_CLOSE () ;}
开发者ID:beku,项目名称:libelektra,代码行数:35,
示例5: test_hostLensDeletevoid test_hostLensDelete(char *sourceFile, char *compFile){ Key *parentKey = keyNew ("user/tests/augeas-hosts", KEY_VALUE, srcdir_file (sourceFile), KEY_END); KeySet *conf = ksNew (20, keyNew ("system/lens", KEY_VALUE, "Hosts.lns", KEY_END), KS_END); PLUGIN_OPEN("augeas"); KeySet *ks = ksNew(0, KS_END); succeed_if(plugin->kdbGet (plugin, ks, parentKey) >= 1, "call to kdbGet was not successful"); succeed_if(output_error (parentKey), "error in kdbGet"); succeed_if(output_warnings (parentKey), "warnings in kdbGet"); Key *key = ksLookupByName (ks, "user/tests/augeas-hosts/1", 0); exit_if_fail(key, "localhost not found"); ksPopAtCursor(ks, ksGetCursor(ks)); keyDel (key); key = ksLookupByName (ks, "user/tests/augeas-hosts/1/ipaddr", 0); exit_if_fail(key, "ip address of localhost not found"); ksPopAtCursor(ks, ksGetCursor(ks)); keyDel (key); key = ksLookupByName (ks, "user/tests/augeas-hosts/1/canonical", 0); exit_if_fail(key, "canonical of localhost not found"); ksPopAtCursor(ks, ksGetCursor(ks)); keyDel (key); key = ksLookupByName (ks, "user/tests/augeas-hosts/1/#comment", 0); exit_if_fail(key, "comment of localhost not found"); ksPopAtCursor(ks, ksGetCursor(ks)); keyDel (key); keySetString (parentKey, elektraFilename()); succeed_if(plugin->kdbSet (plugin, ks, parentKey) == 1, "kdbSet was not successful"); succeed_if(output_error (parentKey), "error in kdbSet"); succeed_if(output_warnings (parentKey), "warnings in kdbSet"); succeed_if( compare_line_files (srcdir_file (compFile), keyString (parentKey)), "files do not match as expected"); ksDel (ks); elektraUnlink(keyString (parentKey)); keyDel (parentKey); PLUGIN_CLOSE () ;}
开发者ID:beku,项目名称:libelektra,代码行数:55,
示例6: test_plainIniEmptyWritestatic void test_plainIniEmptyWrite (char * fileName){ Key * parentKey = keyNew ("user/tests/ini-write", KEY_VALUE, elektraFilename (), KEY_END); KeySet * conf = ksNew (0, KS_END); PLUGIN_OPEN ("ini"); KeySet * ks = ksNew (30, keyNew ("user/tests/ini-write/nosectionkey", KEY_VALUE, "nosectionvalue", KEY_END), keyNew ("user/tests/ini-write/section1", KEY_BINARY, KEY_END), keyNew ("user/tests/ini-write/section1/key1", KEY_VALUE, "value1", KEY_END), keyNew ("user/tests/ini-write/section1/key2", KEY_VALUE, "value2", KEY_END), keyNew ("user/tests/ini-write/section2", KEY_BINARY, KEY_END), keyNew ("user/tests/ini-write/section2/key3", KEY_VALUE, "value3", KEY_END), keyNew ("user/tests/ini-write/section2/emptykey", KEY_META, "ini/empty", "", KEY_END), KS_END); succeed_if (plugin->kdbSet (plugin, ks, parentKey) >= 1, "call to kdbSet was not successful"); succeed_if (output_error (parentKey), "error in kdbSet"); succeed_if (output_warnings (parentKey), "warnings in kdbSet"); succeed_if (compare_line_files (srcdir_file (fileName), keyString (parentKey)), "files do not match as expected"); KeySet * readKS = ksNew (0, KS_END); succeed_if (plugin->kdbGet (plugin, readKS, parentKey) >= 0, "kdbGet failed"); const Key * meta; Key * searchKey = keyNew ("user/tests/ini-write/section2/emptykey", KEY_META, "ini/empty", "", KEY_END); Key * key = ksLookup (readKS, searchKey, KDB_O_NONE); meta = keyGetMeta (key, "ini/empty"); succeed_if (meta != NULL, "reading empty key again failed"); ksDel (readKS); keyDel (parentKey); keyDel (searchKey); ksDel (ks); PLUGIN_CLOSE ();}
开发者ID:fberlakovich,项目名称:libelektra,代码行数:35,
示例7: test_readlinevoid test_readline(){ char * filename = srcdir_file("line/linetest"); Key * parentKey = keyNew ("user/tests/line", KEY_VALUE, filename, KEY_END); KeySet *conf = 0; PLUGIN_OPEN("line"); printf("%s/n", filename); KeySet *ks=ksNew(0, KS_END); succeed_if (plugin->kdbGet(plugin, ks, parentKey) >= 1, "call to kdbGet was not successful"); Key *key = ksLookupByName(ks, "user/tests/line/#0", 0); exit_if_fail (key, "line1 key not found"); succeed_if (strcmp("test1", keyValue(key)) == 0, "line C++ sread函数代码示例 C++ src_strerror函数代码示例
|