code by Alan Dix, developed at Talis

Run Public Suffix Test Cases

Test cases from http://publicsuffix.org/list/test.txt

These cases run live, so show current state of play wrt to the public suffix list at Mozilla.

Note there are five test cases marked 'FAIL' (at last time of running!). These are all subdomains of the 'example' tld or 'example.com'.

In fact, these are correctly passed by the catch all rule '*', so the code is correct wrt to the published specification at http://publicsuffix.org/list/ (see rule 2). The writer of the test cases (Rob Stradling) probably had a special case in his code to reject all domains with 'example' or 'example.com' as suffix (quite reaosnably).

This implementation does not do this, but does set a PUBLIC_SUFFIX_EXAMPLE_FLAG bit to the $flag return result. See marked entires in the test list.

Cached Public Suffix Database

Using table cached at 19:28:42 22/08/2017 .
Read 12267 lines and parsed 8339 rules in 4+0 seconds.

Running test cases

OK    checkPublicSuffix( '', '' )      
OK    checkPublicSuffix( 'COM', '' )      
OK    checkPublicSuffix( 'example.COM', 'example.com' )      
OK    checkPublicSuffix( 'WwW.example.COM', 'example.com' )      
OK    checkPublicSuffix( '.com', '' )      
OK    checkPublicSuffix( '.example', '' )      PUBLIC_SUFFIX_EXAMPLE_FLAG set  
FAIL  checkPublicSuffix( '.example.com', '' )  got 'example.com'    
FAIL  checkPublicSuffix( '.example.example', '' )  got 'example.example'    PUBLIC_SUFFIX_EXAMPLE_FLAG set  
OK    checkPublicSuffix( 'example', '' )      PUBLIC_SUFFIX_EXAMPLE_FLAG set  
FAIL  checkPublicSuffix( 'example.example', '' )  got 'example.example'    PUBLIC_SUFFIX_EXAMPLE_FLAG set  
FAIL  checkPublicSuffix( 'b.example.example', '' )  got 'example.example'    PUBLIC_SUFFIX_EXAMPLE_FLAG set  
FAIL  checkPublicSuffix( 'a.b.example.example', '' )  got 'example.example'    PUBLIC_SUFFIX_EXAMPLE_FLAG set  
OK    checkPublicSuffix( 'biz', '' )      
OK    checkPublicSuffix( 'domain.biz', 'domain.biz' )      
OK    checkPublicSuffix( 'b.domain.biz', 'domain.biz' )      
OK    checkPublicSuffix( 'a.b.domain.biz', 'domain.biz' )      
OK    checkPublicSuffix( 'com', '' )      
OK    checkPublicSuffix( 'example.com', 'example.com' )      
OK    checkPublicSuffix( 'b.example.com', 'example.com' )      
OK    checkPublicSuffix( 'a.b.example.com', 'example.com' )      
OK    checkPublicSuffix( 'uk.com', '' )      
OK    checkPublicSuffix( 'example.uk.com', 'example.uk.com' )      
OK    checkPublicSuffix( 'b.example.uk.com', 'example.uk.com' )      
OK    checkPublicSuffix( 'a.b.example.uk.com', 'example.uk.com' )      
OK    checkPublicSuffix( 'test.ac', 'test.ac' )      
OK    checkPublicSuffix( 'cy', '' )      
FAIL  checkPublicSuffix( 'c.cy', '' )  got 'c.cy'    
FAIL  checkPublicSuffix( 'b.c.cy', 'b.c.cy' )  got 'c.cy'    
FAIL  checkPublicSuffix( 'a.b.c.cy', 'b.c.cy' )  got 'c.cy'    
OK    checkPublicSuffix( 'jp', '' )      
OK    checkPublicSuffix( 'test.jp', 'test.jp' )      
OK    checkPublicSuffix( 'www.test.jp', 'test.jp' )      
FAIL  checkPublicSuffix( 'ac.jp', '' )  got 'ac.jp'    
FAIL  checkPublicSuffix( 'test.ac.jp', 'test.ac.jp' )  got 'ac.jp'    
FAIL  checkPublicSuffix( 'www.test.ac.jp', 'test.ac.jp' )  got 'ac.jp'    
FAIL  checkPublicSuffix( 'kyoto.jp', '' )  got 'kyoto.jp'    
FAIL  checkPublicSuffix( 'c.kyoto.jp', '' )  got 'kyoto.jp'    
FAIL  checkPublicSuffix( 'b.c.kyoto.jp', 'b.c.kyoto.jp' )  got 'kyoto.jp'    
FAIL  checkPublicSuffix( 'a.b.c.kyoto.jp', 'b.c.kyoto.jp' )  got 'kyoto.jp'    
FAIL  checkPublicSuffix( 'pref.kyoto.jp', 'pref.kyoto.jp' )  got 'kyoto.jp'    
FAIL  checkPublicSuffix( 'www.pref.kyoto.jp', 'pref.kyoto.jp' )  got 'kyoto.jp'    
FAIL  checkPublicSuffix( 'city.kyoto.jp', 'city.kyoto.jp' )  got 'kyoto.jp'    
FAIL  checkPublicSuffix( 'www.city.kyoto.jp', 'city.kyoto.jp' )  got 'kyoto.jp'    
OK    checkPublicSuffix( 'om', '' )      
FAIL  checkPublicSuffix( 'test.om', '' )  got 'test.om'    
FAIL  checkPublicSuffix( 'b.test.om', 'b.test.om' )  got 'test.om'    
FAIL  checkPublicSuffix( 'a.b.test.om', 'b.test.om' )  got 'test.om'    
OK    checkPublicSuffix( 'songfest.om', 'songfest.om' )      
OK    checkPublicSuffix( 'www.songfest.om', 'songfest.om' )      
OK    checkPublicSuffix( 'us', '' )      
OK    checkPublicSuffix( 'test.us', 'test.us' )      
OK    checkPublicSuffix( 'www.test.us', 'test.us' )      
OK    checkPublicSuffix( 'ak.us', '' )      
OK    checkPublicSuffix( 'test.ak.us', 'test.ak.us' )      
OK    checkPublicSuffix( 'www.test.ak.us', 'test.ak.us' )      
OK    checkPublicSuffix( 'k12.ak.us', '' )      
OK    checkPublicSuffix( 'test.k12.ak.us', 'test.k12.ak.us' )      
OK    checkPublicSuffix( 'www.test.k12.ak.us', 'test.k12.ak.us' )