KiCad PCB EDA Suite
Loading...
Searching...
No Matches
test_cadstar_parts_parser.cpp File Reference
#include <iostream>
#include <qa_utils/wx_utils/unit_test_utils.h>
#include <algorithm>
#include <optional>
#include <pegtl/contrib/analyze.hpp>
#include <pegtl/contrib/trace.hpp>
#include <common/io/cadstar/cadstar_parts_lib_grammar.h>
#include <common/io/cadstar/cadstar_parts_lib_parser.h>

Go to the source code of this file.

Classes

struct  CHECK_HEADER_CASE
 

Functions

 BOOST_AUTO_TEST_SUITE (CadstarPartParser)
 
static std::string getCadstarTestFile (const std::string &aFile)
 
 BOOST_AUTO_TEST_CASE (AnalyzeGrammar)
 
 BOOST_AUTO_TEST_CASE (CheckHeader)
 
 BOOST_AUTO_TEST_CASE (ReadFile)
 
 BOOST_AUTO_TEST_CASE (ReadContent)
 

Variables

static const std::vector< CHECK_HEADER_CASEcheck_header_cases
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( AnalyzeGrammar  )

Definition at line 43 of file test_cadstar_parts_parser.cpp.

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( CheckHeader  )

◆ BOOST_AUTO_TEST_CASE() [3/4]

◆ BOOST_AUTO_TEST_CASE() [4/4]

◆ BOOST_AUTO_TEST_SUITE()

BOOST_AUTO_TEST_SUITE ( CadstarPartParser  )

◆ getCadstarTestFile()

static std::string getCadstarTestFile ( const std::string &  aFile)
static

Definition at line 37 of file test_cadstar_parts_parser.cpp.

References KI_TEST::GetEeschemaTestDataDir().

Referenced by BOOST_AUTO_TEST_CASE().

Variable Documentation

◆ check_header_cases

const std::vector<CHECK_HEADER_CASE> check_header_cases
static
Initial value:
=
{
{ "1: Normal header", "# Format 32\r\n", true },
{ "2: Normal header, extra content", "# Format 32\r\nExtraUnrelatedContent", true },
{ "3: Normal header extra spaces (1)", "# Format 32\r\n", true },
{ "4: Normal header extra spaces (2)", "# FORMAT 32\r\n", true },
{ "5: Normal header on 2nd line", "\r\n# Format 32\r\n", false },
{ "6: Normal header prepended", "+# Format 32\r\n", false },
{ "7: Normal header prepended spaces", " # Format 32\r\n", false },
{ "8: No header", ".PART-NAME :1 ;Part Descr\r\n", true },
{ "9: No header, extra content", ".PART-NAME :1 ;Part Descr\r\nExtra", true },
{ "10: No header, on 2nd line", "\r\n.PART-NAME :1 ;Part Descr\r\n", true },
{ "11: No header, on 3rd line", "\r\n\r\n.PART-NAME :1 ;Part Descr\r\n", true },
{ "12: No header, on 4th line", "\r\n\r\n.PART-NAME :1 ;Part Descr\r\n", true },
{ "13: No header, on 4th line", "\r\n\r\n\r\n\r\n.PART-NAME :1 ;P Descr\r\n", true },
{ "14: No header, on 5th line", "\r\n\r\n\r\n\r\n\r\n.P-NAME :1 ;PDescr\r\n", true },
{ "15: No header, on 6th line", "\r\n\r\n\r\n\r\n\r\n\r\n.P-NAM :1 ;PDes\r\n", false },
{ "16: No header, space prepend", " .PART-NAME :1 ;Part Descr\r\n", false },
{ "17: No header, spaces & 2nd line", " \r\n.PART-NAME :1 ;Part Descr\r\n", true },
{ "18: No header, 2nd line & space", " \r\n .PART-NAME :1 ;Part Descr\r\n", false },
}

Definition at line 63 of file test_cadstar_parts_parser.cpp.

Referenced by BOOST_AUTO_TEST_CASE().