P4C
The P4 Compiler
Loading...
Searching...
No Matches
pna/backend/stf/stf.h
1#ifndef BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_PNA_BACKEND_STF_STF_H_
2#define BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_PNA_BACKEND_STF_STF_H_
3
4#include <cstddef>
5#include <string>
6#include <vector>
7
8#include <inja/inja.hpp>
9
10#include "lib/cstring.h"
11
12#include "backends/p4tools/modules/testgen/lib/test_framework.h"
13#include "backends/p4tools/modules/testgen/lib/test_object.h"
14#include "backends/p4tools/modules/testgen/lib/test_spec.h"
15
17
19class STF : public TestFramework {
20 public:
21 explicit STF(const TestBackendConfiguration &testBackendConfiguration);
22
24 void writeTestToFile(const TestSpec *spec, cstring selectedBranches, size_t testId,
25 float currentCoverage) override;
26
27 private:
33 void emitTestcase(const TestSpec *testSpec, cstring selectedBranches, size_t testId,
34 const std::string &testCase, float currentCoverage);
35
37 static std::string getTestCaseTemplate();
38
40 static inja::json getControlPlane(const TestSpec *testSpec);
41
43 static inja::json getSend(const TestSpec *testSpec);
44
46 static inja::json getExpectedPacket(const TestSpec *testSpec);
47
49 static inja::json getControlPlaneForTable(const TableMatchMap &matches,
50 const std::vector<ActionArg> &args);
51};
52
53} // namespace P4::P4Tools::P4Testgen::Pna
54
55#endif /* BACKENDS_P4TOOLS_MODULES_TESTGEN_TARGETS_PNA_BACKEND_STF_STF_H_ */
void writeTestToFile(const TestSpec *spec, cstring selectedBranches, size_t testId, float currentCoverage) override
Produce an STF test.
Definition pna/backend/stf/stf.cpp:214
TestFramework(const TestBackendConfiguration &testBackendConfiguration)
Creates a generic test framework.
Definition test_framework.cpp:7
Definition lib/test_spec.h:297
Definition cstring.h:85
Inja.
Definition pna/backend/metadata/metadata.cpp:24
Definition test_backend_configuration.h:16