KiCad PCB EDA Suite
drc_test_utils.h File Reference

General utilities for DRC-related PCB tests. More...

#include <iostream>
#include <class_marker_pcb.h>

Go to the source code of this file.

Namespaces

 KI_TEST
 

Functions

std::ostream & operator<< (std::ostream &os, const MARKER_PCB &aMarker)
 Define a stream function for logging MARKER_PCB test assertions. More...
 
bool KI_TEST::IsDrcMarkerOfType (const MARKER_PCB &aMarker, int aErrorCode)
 Predicate for testing the type of a DRC marker. More...
 

Detailed Description

General utilities for DRC-related PCB tests.

Definition in file drc_test_utils.h.

Function Documentation

◆ operator<<()

std::ostream& operator<< ( std::ostream &  os,
const MARKER_PCB aMarker 
)

Define a stream function for logging MARKER_PCB test assertions.

This has to be in the same namespace as MARKER_PCB

Note: this assumes there is not a operator<< for this type in the main Pcbnew library. If one is introduced there, this one should be removed.

TODO: convert to boost_test_print_type when Boost minver > 1.64. This will keep testing logging and application-level operator<< implementations separate, as they should be.

Definition at line 27 of file drc_test_utils.cpp.

28 {
29  const auto& reporter = aMarker.GetRCItem();
30  os << "MARKER_PCB[\n";
31  os << " type=" << reporter->GetErrorCode() << " (" << reporter->GetErrorText() << ")"
32  << "\n";
33  os << "]";
34  return os;
35 }
std::shared_ptr< RC_ITEM > GetRCItem() const
Function GetReporter returns the DRC_ITEM held within this MARKER so that its interface may be used.
Definition: marker_base.h:120

References MARKER_BASE::GetRCItem().