AsmGrader 0.0.0
Loading...
Searching...
No Matches
macros.hpp File Reference
Include dependency graph for macros.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ASSIGNMENT(cpp_identifier, name, executable)
 
#define TEST_IMPL(ident, name, ...)
 
#define TEST(name, ...)
 
#define PROF_ONLY_TEST(name, ...)
 
#define REQUIRE(condition, ...)
 
#define REQUIRE_EQ(lhs, rhs, ...)
 
#define FILE_METADATA(...)
 

Macro Definition Documentation

◆ ASSIGNMENT

#define ASSIGNMENT ( cpp_identifier,
name,
executable )
Value:
const static Assignment& cpp_identifier = /* NOLINT(misc-use-anonymous-namespace)*/ \
::asmgrader::GlobalRegistrar::get().add(Assignment{name, executable});

◆ FILE_METADATA

#define FILE_METADATA ( ...)
Value:
namespace asmgrader::metadata { \
consteval auto global_file_metadata() { \
using ::asmgrader::metadata::Assignment, metadata::Weight, metadata::ProfOnly; \
return ::asmgrader::metadata::Metadata{__VA_ARGS__}; \
} \
}
Definition metadata.hpp:20
constexpr auto ProfOnly
Definition metadata.hpp:46

◆ PROF_ONLY_TEST

#define PROF_ONLY_TEST ( name,
... )
Value:
[[maybe_unused]] static void CONCAT(prof_test_unused, __COUNTER__)(TestContext & ctx)
#define CONCAT(a, b)
Definition macros.hpp:6

◆ REQUIRE

#define REQUIRE ( condition,
... )
Value:
__extension__({ \
auto cond__var = condition; \
bool cond__bool__val = static_cast<bool>(cond__var); \
if (!cond__bool__val) { \
LOG_DEBUG("Requirement failed: {}", cond__var); \
} \
ctx.require(cond__bool__val, __VA_ARGS__ __VA_OPT__(, )::asmgrader::RequirementResult::DebugInfo{#condition}); \
})
Definition grading_session.hpp:77

◆ REQUIRE_EQ

#define REQUIRE_EQ ( lhs,
rhs,
... )
Value:
__extension__({ \
const auto& req_eq_lhs__ = (lhs); \
const auto& req_eq_rhs__ = (rhs); \
bool req_eq_res__ = \
ctx.require(req_eq_lhs__ == req_eq_rhs__, \
__VA_ARGS__ __VA_OPT__(, )::asmgrader::RequirementResult::DebugInfo{#lhs " == " #rhs}); \
if (!req_eq_res__) { \
LOG_DEBUG("{} != {}", (req_eq_lhs__), (req_eq_rhs__)); \
} \
req_eq_res__; \
})

◆ TEST

#define TEST ( name,
... )
Value:
TEST_IMPL(CONCAT(TEST__, __COUNTER__), name __VA_OPT__(, ) __VA_ARGS__)
#define TEST_IMPL(ident, name,...)
Definition macros.hpp:17

◆ TEST_IMPL

#define TEST_IMPL ( ident,
name,
... )
Value:
namespace { \
class ident final : public ::asmgrader::TestBase \
{ \
public: \
using TestBase::TestBase; \
void run(::asmgrader::TestContext& ctx) override; \
}; \
using namespace ::asmgrader::metadata; /*NOLINT(google-build-using-namespace)*/ \
constexpr auto CONCAT(ident, \
::asmgrader::metadata::global_file_metadata() \
__VA_OPT__(, ) __VA_ARGS__); \
const ::asmgrader::TestAutoRegistrar<ident> CONCAT(ident, __registrar){name, CONCAT(ident, __metadata)}; \
} \
void ident::run([[maybe_unused]] ::asmgrader::TestContext& ctx)
Base class primarily for a user-written test.
Definition test_base.hpp:17
virtual void run(TestContext &ctx)=0
User-facing API for use within an assignment test case for: Interacting with or querying data for the...
Definition test_context.hpp:40
consteval auto create(Args &&... args)
Definition metadata.hpp:173
constexpr Metadata DEFAULT_METADATA
Definition metadata.hpp:274