libtest: Add T_push_plan() and T_pop_plan()

Update #3199.
This commit is contained in:
Sebastian Huber
2020-08-18 07:08:51 +02:00
parent 13acd90003
commit c728948434
4 changed files with 44 additions and 2 deletions
+6
View File
@@ -2168,6 +2168,12 @@ void T_check_rsc_success(const T_check_context *, uint32_t);
void T_plan(unsigned int);
extern const T_fixture T_empty_fixture;
void T_push_plan(T_fixture_node *, unsigned int);
void T_pop_plan(void);
void T_check_step(const T_check_context *, unsigned int);
#define T_flags_step(a, flags) \
+15
View File
@@ -550,6 +550,21 @@ void T_plan(unsigned int planned_steps)
expected);
}
const T_fixture T_empty_fixture;
void
T_push_plan(T_fixture_node *node, unsigned int planned_steps)
{
T_push_fixture(node, &T_empty_fixture);
T_plan(planned_steps);
}
void
T_pop_plan(void)
{
T_pop_fixture();
}
void
T_check_step(const T_check_context *t, unsigned int expected)
{
+2 -2
View File
@@ -182,8 +182,8 @@ run_initialize(void)
T_set_putchar(censor_putchar, ctx, &ctx->putchar, &ctx->putchar_arg);
}
static const char expected_final[] = "Z:ttest01:C:343:N:1335:F:795:D:0.689999\n"
"Y:ReportHash:SHA256:525591019364543d5694dd09fef3bf2f0b7db69694f959e4298f22f4f9803fef\n";
static const char expected_final[] = "Z:ttest01:C:344:N:1339:F:795:D:0.691999\n"
"Y:ReportHash:SHA256:23dd328162c564ada3c4de97446801018ade051aaec3308bb9a7ef8f98041d67\n";
static void
run_finalize(void)
+21
View File
@@ -34,6 +34,19 @@ T_TEST_CASE(steps)
T_step(2);
}
static T_fixture_node nested_plan_node;
T_TEST_CASE(nested_plan)
{
T_plan(2);
T_step(0);
T_push_plan(&nested_plan_node, 2);
T_step(0);
T_step(1);
T_pop_plan();
T_step(1);
}
#include "t-self-test.h"
T_TEST_OUTPUT(wrong_step,
@@ -65,6 +78,14 @@ T_TEST_OUTPUT(steps,
"P:2:0:UI1:test-plan.c:34\n"
"E:steps:N:3:F:0:D:0.001000\n");
T_TEST_OUTPUT(nested_plan,
"B:nested_plan\n"
"P:0:0:UI1:test-plan.c:42\n"
"P:1.0:0:UI1:test-plan.c:44\n"
"P:1.1:0:UI1:test-plan.c:45\n"
"P:1:0:UI1:test-plan.c:47\n"
"E:nested_plan:N:4:F:0:D:0.001000\n");
/*
* The license is at the end of the file to be able to use the test code and
* output in examples in the documentation. This is also the reason for the