echo unitTest("123456789012345678901234567890123456789012345678901234567890@12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.12345678901234567890123456789012345678901234567890123456789.1234.example.com", false, "Entire address is longer than 256 characters");
echo unitTest("first.last", false, "No @");
echo unitTest("12345678901234567890123456789012345678901234567890123456789012345@example.com", false, "Local part more than 64 characters");
echo unitTest(".first.last@example.com", false, "Local part starts with a dot");
echo unitTest("first.last.@example.com", false, "Local part ends with a dot");
echo unitTest("first..last@example.com", false, "Local part has consecutive dots");
echo unitTest("\"first\"last\"@example.com", false, "Local part contains unescaped excluded characters");
echo unitTest("\"first\\last\"@example.com", true, "Any character can be escaped in a quoted string");
echo unitTest("\"\"\"@example.com", false, "Local part contains unescaped excluded characters");
echo unitTest("\"\\\"@example.com", false, "Local part cannot end with a backslash");
echo unitTest("\"\"@example.com", false, "Local part is effectively empty");
echo unitTest("first\\\\@last@example.com", false, "Local part contains unescaped excluded characters");
echo unitTest("first.last@[IPv6:1111:2222:3333:4444:5555:6666:7777:8888:9999]", false, "Too many IPv6 groups (8 max)");
echo unitTest("first.last@[IPv6:1111:2222::3333::4444:5555:6666]", false, "Too many '::' (can be none or one)");
echo unitTest("first.last@[IPv6:1111:2222:3333::4444:5555:6666:7777]", false, "Too many IPv6 groups (6 max)");
echo unitTest("first.last@[IPv6:1111:2222:333x::4444:5555]", false, "x is not valid in an IPv6 address");
echo unitTest("first.last@[IPv6:1111:2222:33333::4444:5555]", false, "33333 is not a valid group in an IPv6 address");
echo unitTest("first.last@example.123", false, "TLD can't be all digits");
echo unitTest("first.last@com", false, "Mail host must be second- or lower level");
echo unitTest("first.last@-xample.com", false, "Label can't begin with a hyphen");
echo unitTest("first.last@exampl-.com", false, "Label can't end with a hyphen");
echo unitTest("first.last@x234567890123456789012345678901234567890123456789012345678901234.example.com", false, "Label can't be longer than 63 octets");
echo unitTest("test@123.123.123.123", false, "Top Level Domain won't be all-numeric (see RFC3696 Section 2). I disagree with Dave Child on this one.");
echo unitTest("test@123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012.com", false, "255 characters is maximum length for domain. This is 256.");
echo unitTest("first.\"\".last@example.com", false, "Contains a zero-length element");
echo unitTest("first\\last@example.com", false, "Unquoted string must be an atom");
echo unitTest("Abc\\@def@example.com", false, "Was incorrectly given as a valid address in the original RFC3696");
echo unitTest("Fred\\ Bloggs@example.com", false, "Was incorrectly given as a valid address in the original RFC3696");
echo unitTest("Joe.\\\\Blow@example.com", false, "Was incorrectly given as a valid address in the original RFC3696");
echo unitTest("first.last@[IPv6:1111:2222:3333:4444:5555:6666:12.34.567.89]", false, "IPv4 part contains an invalid octet");
echo unitTest("\"test\\\r\n blah\"@example.com", false, "Folding white space can't appear within a quoted pair");
echo unitTest("\"test\r\n blah\"@example.com", true, "This is a valid quoted string with folding white space");
echo unitTest("{^c\\@**Dog^}@cartoon.com", false, "This is a throwaway example from Doug Lovell's article. Actually it's not a valid address.");
echo unitTest("(foo)cal(bar)@(baz)iamcal.com(quux)", true, "A valid address containing comments");
echo unitTest("cal@iamcal(woo).(yay)com", true, "A valid address containing comments");
echo unitTest("\"foo\"(yay)@(hoopla)[1.2.3.4]", false, "Address literal can't be commented (RFC5321)");
echo unitTest("cal(woo(yay)hoopla)@iamcal.com", true, "A valid address containing comments");
echo unitTest("cal(foo\\@bar)@iamcal.com", true, "A valid address containing comments");
echo unitTest("cal(foo\\)bar)@iamcal.com", true, "A valid address containing comments and an escaped parenthesis");
echo unitTest("cal(foo(bar)@iamcal.com", false, "Unclosed parenthesis in comment");
echo unitTest("cal(foo)bar)@iamcal.com", false, "Too many closing parentheses");
echo unitTest("cal(foo\\)@iamcal.com", false, "Backslash at end of comment has nothing to escape");
echo unitTest("first().last@example.com", true, "A valid address containing an empty comment");
echo unitTest("first.(\r\n middle\r\n )last@example.com", true, "Comment with folding white space");
echo unitTest("first(12345678901234567890123456789012345678901234567890)last@(1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890)example.com", false, "Too long with comments, not too long without");
echo unitTest("first(Welcome to\r\n the (\"wonderful\" (!)) world\r\n of email)@example.com", true, "Silly example from my blog post");
echo unitTest("pete(his account)@silly.test(his host)", true, "Canonical example from RFC5322");
echo unitTest("c@(Chris's host.)public.example", true, "Canonical example from RFC5322");
echo unitTest("jdoe@machine(comment). example", true, "Canonical example from RFC5322");
echo unitTest("1234 @ local(blah) .machine .example", true, "Canonical example from RFC5322");
echo unitTest("first(middle)last@example.com", false, "Can't have a comment or white space except at an element boundary");
echo unitTest("first(abc.def).last@example.com", true, "Comment can contain a dot");
echo unitTest("first(a\"bc.def).last@example.com", true, "Comment can contain double quote");
echo unitTest("first.(\")middle.last(\")@example.com", true, "Comment can contain a quote");
echo unitTest("first(abc(\"def\".ghi).mno)middle(abc(\"def\".ghi).mno).last@(abc(\"def\".ghi).mno)example(abc(\"def\".ghi).mno).(abc(\"def\".ghi).mno)com(abc(\"def\".ghi).mno)", false, "Can't have comments or white space except at an element boundary");
echo unitTest("first(abc\\(def)@example.com", true, "Comment can contain quoted-pair");
echo unitTest("first.last@x(1234567890123456789012345678901234567890123456789012345678901234567890).com", true, "Label is longer than 63 octets, but not with comment removed");