1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-03 00:26:59 +02:00

Add backup type conversion functions.

Convert back and forth between the string and enum representations of backup types.
This commit is contained in:
David Steele
2019-08-18 20:09:44 -04:00
parent 3df075bf40
commit 8aa1e552b0
4 changed files with 101 additions and 1 deletions

View File

@ -254,5 +254,18 @@ testRun(void)
TEST_ERROR(ioWrite(write, buffer), AssertError, "should not be possible to see two misaligned pages in a row");
}
// *****************************************************************************************************************************
if (testBegin("backupType() and backupTypeStr()"))
{
TEST_RESULT_UINT(backupType(strNew("full")), backupTypeFull, "backup type full");
TEST_RESULT_UINT(backupType(strNew("diff")), backupTypeDiff, "backup type diff");
TEST_RESULT_UINT(backupType(strNew("incr")), backupTypeIncr, "backup type incr");
TEST_ERROR(backupType(strNew("bogus")), AssertError, "invalid backup type 'bogus'");
TEST_RESULT_STR(strPtr(backupTypeStr(backupTypeFull)), "full", "backup type str full");
TEST_RESULT_STR(strPtr(backupTypeStr(backupTypeDiff)), "diff", "backup type str diff");
TEST_RESULT_STR(strPtr(backupTypeStr(backupTypeIncr)), "incr", "backup type str incr");
}
FUNCTION_HARNESS_RESULT_VOID();
}