Changeset ec3f4c8806db398461503c846ffbb29b678dfdc3

Show
Ignore:
Timestamp:
08/30/06 19:40:36 (2 years ago)
Author:
Clément Stenac <zorglub@videolan.org>
git-committer:
Clément Stenac <zorglub@videolan.org> 1156959636 +0000
git-parent:

[64f018048c04f47d61c05a4ccfeb78755d2705cd]

git-author:
Clément Stenac <zorglub@videolan.org> 1156959636 +0000
Message:

Fix and port test

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • test/native/url.c

    rf834305 rec3f4c8  
    3333    res = f(in); 
    3434    ASSERT( res != NULL, "NULL result" ); 
     35    printf( "\n\"%s\"\n",res ); 
    3536    ASSERT( strcmp( res, out ) == NULL, "" ); 
    3637 
     
    5253{ 
    5354    printf( "\n" ); 
    54     if( !test_decode ("this_should_not_be_modified_1234", 
    55                      "this_should_not_be_modified_1234") ) return NULL; 
    56  
    57     if( ! test_decode ("This+should+be+modified+1234!", 
    58                  "This should be modified 1234!") ) return NULL;; 
    59  
    60     if( !test_decode ("This%20should%20be%20modified%201234!", 
    61                  "This should be modified 1234!")) return NULL;; 
    62  
    63     if( ! test_decode ("%7E", "~")) return NULL;; 
     55#define DO_TEST_DECODE( a, b ) if( !test_decode( a, b) ) return NULL; 
     56     DO_TEST_DECODE ("this_should_not_be_modified_1234", 
     57                     "this_should_not_be_modified_1234"); 
     58     DO_TEST_DECODE ("This+should+be+modified+1234!", 
     59                 "This should be modified 1234!"); 
     60     DO_TEST_DECODE ("This%20should%20be%20modified%201234!", 
     61                 "This should be modified 1234!"); 
     62     DO_TEST_DECODE ("%7E", "~"); 
    6463 
    6564    /* tests with invalid input */ 
    66     if(!test_decode ("%", "%")) return NULL;
    67     if(!test_decode ("%2", "%2")) return NULL;
    68     if(!test_decode ("%0000", "")) return NULL;; 
     65    DO_TEST_DECODE ("%", "%" )
     66    DO_TEST_DECODE ("%2", "%2")
     67    DO_TEST_DECODE ("%0000", "") 
    6968 
    7069    /* UTF-8 tests */ 
    71     if(!test_decode ("T%C3%a9l%c3%A9vision+%e2%82%Ac", 
    72                       "Télévision €" ) ) return NULL; 
    73     if(!test_decode ("T%E9l%E9vision", "T?l?vision")) return NULL; 
    74     if(!test_decode ("%C1%94%C3%a9l%c3%A9vision", 
    75                          "??élévision") ) return NULL; /* overlong */ 
     70    DO_TEST_DECODE ("T%C3%a9l%c3%A9vision+%e2%82%Ac", "Télévision €" ); 
     71    DO_TEST_DECODE ("T%E9l%E9vision", "T?l?vision"); 
     72    DO_TEST_DECODE ("%C1%94%C3%a9l%c3%A9vision",  "??élévision"); 
    7673 
     74#define DO_TEST_B64( a, b ) if( !test_b64( a, b ) ) return NULL; 
    7775    /* Base 64 tests */ 
    78     test_b64 ("", "")
    79     test_b64 ("d", "ZA=="); 
    80     test_b64 ("ab", "YQG="); 
    81     test_b64 ("abc", "YQGI"); 
    82     test_b64 ("abcd", "YQGIZA=="); 
     76    DO_TEST_B64 ("", "")
     77    DO_TEST_B64("d", "ZA=="); 
     78    DO_TEST_B64("ab", "YWI="); 
     79    DO_TEST_B64("abc", "YWJj"); 
     80    DO_TEST_B64 ("abcd", "YWJjZA=="); 
    8381 
    8482    Py_INCREF( Py_None);