P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::P4Tools::Test::P4ToolsTestCase Class Reference

Encapsulates functionality for running the front- and mid-ends of the compiler in a test. More...

#include <gtest_utils.h>

Public Member Functions

 P4ToolsTestCase (const P4Tools::CompilerResult &compilerResults)
 
const P4Tools::CompilerResultgetCompilerResult () const
 
const IR::P4Program & getProgram () const
 

Static Public Member Functions

static std::optional< const P4ToolsTestCasecreate (std::string deviceName, std::string archName, CompilerOptions::FrontendVersion langVersion, const std::string &source)
 Factory method for producing a test case from a P4 program source.
 
static std::optional< const P4ToolsTestCasecreate_14 (std::string deviceName, std::string archName, const std::string &source)
 Factory method for producing a test case from a P4_14 program source.
 
static std::optional< const P4ToolsTestCasecreate_16 (std::string deviceName, std::string archName, const std::string &source)
 Factory method for producing a test case from a P4_16 program source.
 

Detailed Description

Encapsulates functionality for running the front- and mid-ends of the compiler in a test.

Member Function Documentation

◆ getCompilerResult()

const P4Tools::CompilerResult & P4::P4Tools::Test::P4ToolsTestCase::getCompilerResult ( ) const
nodiscard
Returns
the compiler result that was produced by running the compiler on the input P4 Program.

◆ getProgram()

const IR::P4Program & P4::P4Tools::Test::P4ToolsTestCase::getProgram ( ) const
nodiscard
Returns
the P4 program associated with this test case.