21#define BOOST_TEST_NO_MAIN
42 std::string
name =
"valid_filename-123._ok";
43 std::string original =
name;
55 std::string
name = R
"(bad\name/with?illegal*chars|"<>.txt)";
78 std::string
name = R
"(a*bad?name|file)";
88 wxString
name =
"valid_filename-123._ok";
89 wxString original =
name;
100 wxString
name =
"bad\\name/with?illegal*chars|\"<>.txt";
123 wxString
name =
"a*bad?name|file";
155 == wxString(
"/nonexistent/file.pdf" ) );
167static wxString
JoinPins(
const std::vector<wxString>& aPins )
171 for(
const wxString& p : aPins )
172 out <<
'<' << p <<
'>';
187 BOOST_REQUIRE_EQUAL( expanded.size(), 1u );
188 BOOST_TEST( expanded[0] == wxString(
"1,foo,bar,buz" ) );
199 const wxString raw = wxS(
"1,foo" );
202 BOOST_TEST( escaped == wxString(
"1\\,foo" ) );
204 const wxString notation = wxS(
"[" ) + escaped + wxS(
",2]" );
211 BOOST_REQUIRE_EQUAL( expanded.size(), 2u );
223 const wxString notation = wxS(
"[A\\-B,C]" );
230 BOOST_REQUIRE_EQUAL( expanded.size(), 2u );
231 BOOST_TEST( expanded[0] == wxString(
"A-B" ) );
237 BOOST_REQUIRE_EQUAL( expanded.size(), 3u );
262 BOOST_REQUIRE_EQUAL( expanded.size(), 5u );
266 BOOST_TEST( expanded[3] == wxString(
"10" ) );
267 BOOST_TEST( expanded[4] == wxString(
"11" ) );
280 BOOST_REQUIRE_EQUAL( items.size(), 3u );
296 BOOST_REQUIRE_EQUAL( expanded.size(), 2u );
297 BOOST_TEST( expanded[0] == wxString(
"A\\B" ) );
317 BOOST_REQUIRE_EQUAL( expanded.size(), 1u );
333 const std::vector<STRING_ESCAPE_TEST_CASE> testStrings = {
336 {
CTX_NETNAME, wxS(
"a/,b" ), wxS(
"a{slash},b" ) },
343 for(
const auto& testString : testStrings )
345 BOOST_TEST_INFO(
"Testing EscapeString with input: " << testString.Input );
std::vector< wxString > ExpandStackedPinNotation(const wxString &aPinName, bool *aValid)
Expand stacked pin notation like [1,2,3], [1-4], [A1-A4], or [AA1-AA3,AB4,CD12-CD14] into individual ...
wxString UnescapeString(const wxString &aSource)
wxString ConvertPathToFileUri(const wxString &aPath, const PROJECT *aProject)
Convert a file path to a file:// URI.
bool IsAutoGeneratedNetName(const wxString &aNetName)
Recognize the reserved prefixes used for generated pin-net names.
std::vector< wxString > SplitStackedPinDisplayItems(const wxString &aInner)
Split the inner part of a stacked notation string (the text between the brackets) into its individual...
bool ReplaceIllegalFileNameChars(std::string &aName, int aReplaceChar)
Checks aName for illegal file name characters.
wxString EscapeStackedPinItem(const wxString &aPinNumber)
Escape the characters that carry structural meaning inside stacked pin notation ('[',...
wxString EscapeString(const wxString &aSource, ESCAPE_CONTEXT aContext)
The Escape/Unescape routines use HTML-entity-reference-style encoding to handle characters which are:...
int CountStackedPinNotation(const wxString &aPinName, bool *aValid)
Count the number of pins represented by stacked pin notation.
ESCAPE_CONTEXT
Escape/Unescape routines to safely encode reserved-characters in various contexts.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_SUITE_END()
BOOST_TEST(netlist.find("R_G1 ARM_OUT1 DIE_B R='0.001 / ((SW_STATE)") !=std::string::npos)
BOOST_TEST_INFO("Two-port Series .op current = "<< iDevice)
BOOST_AUTO_TEST_CASE(GeneratedNetNamesUseReservedPrefixes)
static wxString JoinPins(const std::vector< wxString > &aPins)