#include "TestLib.h"
int dpiTest_2700_verifySodaCollCursorFuncsWithNull(dpiTestCase *testCase,
dpiTestParams *params)
{
const char *expectedError = "DPI-1002:";
dpiSodaCollCursor_addRef(NULL);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiSodaCollCursor_getNext(NULL, DPI_SODA_FLAGS_DEFAULT, NULL);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
dpiSodaCollCursor_release(NULL);
if (dpiTestCase_expectError(testCase, expectedError) < 0)
return DPI_FAILURE;
return DPI_SUCCESS;
}
int dpiTest_2701_verifySodaCollCursoraddRef(dpiTestCase *testCase,
dpiTestParams *params)
{
dpiSodaCollCursor *cursor;
dpiSodaDb *db;
if (dpiTestCase_getSodaDb(testCase, &db) < 0)
return DPI_FAILURE;
if (dpiSodaDb_getCollections(db, NULL, 0, DPI_SODA_FLAGS_DEFAULT,
&cursor) < 0)
return dpiTestCase_setFailedFromError(testCase);
if (dpiSodaCollCursor_addRef(cursor) < 0)
return dpiTestCase_setFailedFromError(testCase);
if (dpiSodaCollCursor_release(cursor) < 0)
return dpiTestCase_setFailedFromError(testCase);
if (dpiSodaCollCursor_release(cursor) < 0)
return dpiTestCase_setFailedFromError(testCase);
dpiSodaCollCursor_release(cursor);
if (dpiTestCase_expectError(testCase, "DPI-1002:") < 0)
return DPI_FAILURE;
if (dpiSodaDb_release(db) < 0)
return dpiTestCase_setFailedFromError(testCase);
return DPI_SUCCESS;
}
int main(int argc, char **argv)
{
dpiTestSuite_initialize(2700);
dpiTestSuite_addCase(dpiTest_2700_verifySodaCollCursorFuncsWithNull,
"call collection cursor functions with NULL handle");
dpiTestSuite_addCase(dpiTest_2701_verifySodaCollCursoraddRef,
"dpiSodaCollCursor_addRef() works with valid parameters");
return dpiTestSuite_run();
}