CASA/c_test/unx_testcases/testcases.c
2006-01-31 22:01:47 +00:00

174 lines
6.7 KiB
C

/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. Inc. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; version 2.1
* of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
*
***********************************************************************/
#include "testcases.h"
void TestCacheOpenSecretStore_Valid(void);
void TestCacheOpenSecretStore_Invalid_Input(void);
void TestCacheCloseSecretStore_Valid(void);
void TestCacheCloseSecretStore_CloseAfterClose(void);
void TestCacheCloseSecretStore_Invalid_Handle(void);
void TestCacheCloseSecretStore_WithoutOpen(void);
void TestCacheAddKeyChain_Valid(void);
void TestCacheAddKeyChain_LongKeychainId(void);
void TestCacheAddKeyChain_ExistingKeychain(void);
void TestCacheAddKeyChain_MaxKeychains(void);
void TestCacheEnumerateKeyChainIds_Valid(void);
void TestCacheEnumerateKeyChainIds_WithoutOpen(void);
void TestCacheEnumerateKeyChainIds_LessBufferLen(void);
void TestCacheEnumerateKeyChainIds_WithNoKeychains(void);
void TestCacheRemoveKeyChain_Valid(void);
void TestCacheRemoveKeyChain_NonExistentKeychain(void);
void TestCacheRemoveKeyChain_OverlappingNames(void);
void TestCacheRWRmSecret_ValidAddSecret(void);
void TestCacheRWRmSecret_LongSecretID(void);
void TestCacheRWSecret_ValidUpdateSecret(void);
void TestCacheRWRmSecret_NonExistentKeychain(void);
void TestCacheRWRmSecret_OverlappingNames(void);
void TestCacheGetSecretStoreInfo_Valid(void);
void TestCacheGetKeychainInfo_Valid(void);
void TestLockCache_Valid(void);
void TestUnlockCache_Valid(void);
/*
*/
int main(int argc, char** argv)
{
CU_pSuite pGenericSSGroup = NULL;
CU_pSuite pKeyChainGroup = NULL;
CU_pSuite pSecretGroup = NULL;
CU_pTest pTest = NULL;
if (CU_initialize_registry())
return 1;
pGenericSSGroup = CU_add_suite("TestCacheOpenSecretStore",NULL,NULL);
if (!pGenericSSGroup)
{
CU_cleanup_registry();
return -1;
}
pTest = CU_add_test(pGenericSSGroup, "TestCacheOpenSecretStore_Valid",TestCacheOpenSecretStore_Valid);
TEST_PTEST
pTest = CU_add_test(pGenericSSGroup, "TestCacheOpenSecretStore_Invalid_Input",TestCacheOpenSecretStore_Invalid_Input);
TEST_PTEST
pGenericSSGroup = CU_add_suite("TestCacheCloseSecretStore",NULL,NULL);
if(!pGenericSSGroup)
{
CU_cleanup_registry();
return -1;
}
pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_Valid",TestCacheCloseSecretStore_Valid);
TEST_PTEST
// pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_WithoutOpen",TestCacheCloseSecretStore_WithoutOpen);
TEST_PTEST
pKeyChainGroup = CU_add_suite("TestCacheEnumerateKeyChainIds",NULL,NULL);
if(!pKeyChainGroup)
{
CU_cleanup_registry();
return -1;
}
pTest = CU_add_test(pKeyChainGroup,"TestCacheAddKeyChain_Valid",TestCacheAddKeyChain_Valid);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheAddKeyChain_LongKeychainId",TestCacheAddKeyChain_LongKeychainId);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheAddKeyChain_ExistingKeychain",TestCacheAddKeyChain_ExistingKeychain);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheAddKeyChain_MaxKeychains",TestCacheAddKeyChain_MaxKeychains);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_Valid",TestCacheEnumerateKeyChainIds_Valid);
TEST_PTEST
// pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_WithoutOpen",TestCacheEnumerateKeyChainIds_WithoutOpen);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_WithNoKeychains",TestCacheEnumerateKeyChainIds_WithNoKeychains);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheRemoveKeyChain_Valid",TestCacheRemoveKeyChain_Valid);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheRemoveKeyChain_NonExistentKeychain",TestCacheRemoveKeyChain_NonExistentKeychain);
TEST_PTEST
pTest = CU_add_test(pKeyChainGroup, "TestCacheRemoveKeyChain_OverlappingNames",TestCacheRemoveKeyChain_OverlappingNames);
TEST_PTEST
pSecretGroup = CU_add_suite("TestCacheSecretAPIs",NULL,NULL);
if(!pGenericSSGroup)
{
CU_cleanup_registry();
return -1;
}
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_ValidAddSecret",TestCacheRWRmSecret_ValidAddSecret);
TEST_PTEST
pTest = CU_add_test(pSecretGroup, "TestCacheRWSecret_ValidUpdateSecret",TestCacheRWSecret_ValidUpdateSecret);
TEST_PTEST
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_NonExistentKeychain",TestCacheRWRmSecret_NonExistentKeychain);
TEST_PTEST
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_OverlappingNames",TestCacheRWRmSecret_OverlappingNames);
TEST_PTEST
pTest = CU_add_test(pSecretGroup, "TestCacheRWRmSecret_LongSecretID",TestCacheRWRmSecret_LongSecretID);
TEST_PTEST
pTest = CU_add_test(pGenericSSGroup, "TestCacheGetSecretStoreInfo_Valid",TestCacheGetSecretStoreInfo_Valid);
TEST_PTEST
pTest = CU_add_test(pGenericSSGroup, "TestCacheGetKeychainInfo_Valid",TestCacheGetKeychainInfo_Valid);
TEST_PTEST
pTest = CU_add_test(pGenericSSGroup, "TestLockCache_Valid",TestLockCache_Valid);
TEST_PTEST
pTest = CU_add_test(pGenericSSGroup, "TestUnlockCache_Valid",TestUnlockCache_Valid);
TEST_PTEST
/*DANGER - Test with latest cachelib*/
// pTest = CU_add_test(pKeyChainGroup, "TestCacheEnumerateKeyChainIds_LessBufferLen",TestCacheEnumerateKeyChainIds_LessBufferLen);
TEST_PTEST
// pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_CloseAfterClose",TestCacheCloseSecretStore_CloseAfterClose);
TEST_PTEST
// pTest = CU_add_test(pGenericSSGroup, "TestCacheCloseSecretStore_Invalid_Handle",TestCacheCloseSecretStore_Invalid_Handle);
TEST_PTEST
/* Run the tests. */
// CU_curses_run_tests();
CU_console_run_tests();
CU_cleanup_registry();
return 0;
}