#ifndef kc_helpers_h
#define kc_helpers_h
#include <stdlib.h>
#include <unistd.h>
#include <Security/Security.h>
#include <Security/SecKeychainPriv.h>
#include "utilities/SecCFRelease.h"
#include "kc-keychain-file-helpers.h"
extern char keychainFile[1000];
extern char keychainDbFile[1000];
extern char keychainTempFile[1000];
extern char keychainName[1000];
extern char testName[1000];
static inline bool CFEqualSafe(CFTypeRef left, CFTypeRef right)
{
if (left == NULL || right == NULL)
return left == right;
else
return CFEqual(left, right);
}
void startTest(const char* thisTestName);
void initializeKeychainTests(const char* thisTestName);
void deleteTestFiles(void);
void addToSearchList(SecKeychainRef keychain);
SecKeychainItemRef checkNCopyFirst(char* testName, const CFDictionaryRef CF_CONSUMED query, uint32_t n);
void checkN(char* testName, const CFDictionaryRef CF_CONSUMED query, uint32_t n);
#define checkNTests 3
void readPasswordContentsWithResult(SecKeychainItemRef item, OSStatus expectedResult, CFStringRef expectedContents);
#define readPasswordContentsWithResultTests 3
void readPasswordContents(SecKeychainItemRef item, CFStringRef expectedContents);
#define readPasswordContentsTests readPasswordContentsWithResultTests
void changePasswordContents(SecKeychainItemRef item, CFStringRef newPassword);
#define changePasswordContentsTests 1
void deleteItem(SecKeychainItemRef item);
#define deleteItemTests 1
void deleteItems(CFArrayRef items);
#define deleteItemsTests 1
uint32_t checkPrompts(uint32_t expectedSinceLastCall, char* explanation);
#define checkPromptsTests 2
#endif