Changeset f834305242997bff8e941b4362f147ba2594f4fb
- Timestamp:
- 08/30/06 19:17:11
(2 years ago)
- Author:
- Clément Stenac <zorglub@videolan.org>
- git-committer:
- Clément Stenac <zorglub@videolan.org> 1156958231 +0000
- git-parent:
[f7f09d38fab255e32b511abe723745c8c781cd06]
- git-author:
- Clément Stenac <zorglub@videolan.org> 1156958231 +0000
- Message:
Port new URL tests to test/
Support Python 2.4
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r4db506d |
rf834305 |
|
| 5 | 5 | class NativeURLTestCase( unittest.TestCase ): |
|---|
| 6 | 6 | def testurl_decode( self ): |
|---|
| 7 | | """[URL] Test url_decode""" |
|---|
| 8 | | native_libvlc_test.url_decode_test() |
|---|
| | 7 | """[URL] Test url_decode and base64""" |
|---|
| | 8 | native_libvlc_test.url_test() |
|---|
| r0fbf13c |
rf834305 |
|
| 17 | 17 | DEF_METHOD( timers_test, "Test timers" ) |
|---|
| 18 | 18 | DEF_METHOD( i18n_atof_test, "Test i18n_atof" ) |
|---|
| 19 | | DEF_METHOD( url_decode_test, "URL decoding" ) |
|---|
| | 19 | DEF_METHOD( url_test, "URL decoding" ) |
|---|
| 20 | 20 | DEF_METHOD( chains_test, "Test building of chains" ) |
|---|
| 21 | 21 | DEF_METHOD( gui_chains_test, "Test interactions between chains and GUI" ) |
|---|
| r0fbf13c |
rf834305 |
|
| 10 | 10 | PyObject *timers_test( PyObject *self, PyObject *args ); |
|---|
| 11 | 11 | |
|---|
| 12 | | PyObject *url_decode_test( PyObject *self, PyObject *args ); |
|---|
| | 12 | PyObject *url_test( PyObject *self, PyObject *args ); |
|---|
| 13 | 13 | |
|---|
| 14 | 14 | PyObject *i18n_atof_test( PyObject *self, PyObject *args ); |
|---|
| r0fbf13c |
rf834305 |
|
| 24 | 24 | #include "vlc_url.h" |
|---|
| 25 | 25 | |
|---|
| 26 | | PyObject * test_decode (const char *in, const char *out) |
|---|
| | 26 | typedef char * (*conv_t ) (const char *); |
|---|
| | 27 | |
|---|
| | 28 | PyObject * test (conv_t f, const char *in, const char *out) |
|---|
| 27 | 29 | { |
|---|
| 28 | 30 | char *res; |
|---|
| 29 | 31 | |
|---|
| 30 | 32 | printf ("\"%s\" -> \"%s\" ?\n", in, out); |
|---|
| 31 | | res = decode_URI_duplicate (in); |
|---|
| 32 | | ASSERT( res != NULL, "" ); |
|---|
| 33 | | if (res == NULL) |
|---|
| 34 | | exit (1); |
|---|
| 35 | | |
|---|
| | 33 | res = f(in); |
|---|
| | 34 | ASSERT( res != NULL, "NULL result" ); |
|---|
| 36 | 35 | ASSERT( strcmp( res, out ) == NULL, "" ); |
|---|
| 37 | 36 | |
|---|
| … | … | |
| 40 | 39 | } |
|---|
| 41 | 40 | |
|---|
| 42 | | PyObject *url_decode_test( PyObject *self, PyObject *args ) |
|---|
| | 41 | static inline PyObject * test_decode( const char *in, const char *out) |
|---|
| | 42 | { |
|---|
| | 43 | return test( decode_URI_duplicate, in, out ); |
|---|
| | 44 | } |
|---|
| | 45 | |
|---|
| | 46 | static inline PyObject* test_b64( const char *in, const char *out ) |
|---|
| | 47 | { |
|---|
| | 48 | return test( vlc_b64_encode, in, out ); |
|---|
| | 49 | } |
|---|
| | 50 | |
|---|
| | 51 | PyObject *url_test( PyObject *self, PyObject *args ) |
|---|
| 43 | 52 | { |
|---|
| 44 | 53 | printf( "\n" ); |
|---|
| … | … | |
| 66 | 75 | "??élévision") ) return NULL; /* overlong */ |
|---|
| 67 | 76 | |
|---|
| | 77 | /* 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=="); |
|---|
| | 83 | |
|---|
| 68 | 84 | Py_INCREF( Py_None); |
|---|
| 69 | 85 | return Py_None; |
|---|
| r0fbf13c |
rf834305 |
|
| 2 | 2 | |
|---|
| 3 | 3 | set -e |
|---|
| 4 | | python setup.py build |
|---|
| | 4 | python setup.py build |
|---|
| 5 | 5 | |
|---|
| 6 | 6 | cd .. |
|---|
| 7 | 7 | # TODO: FIXME !! |
|---|
| 8 | | export PYTHONPATH=$PYTHONPATH:bindings/mediacontrol-python/build/lib.linux-i686-2.3:test/build/lib.linux-i686-2.3:test/build/lib.linux-x86_64-2.3 |
|---|
| | 8 | export PYTHONPATH=$PYTHONPATH:bindings/mediacontrol-python/build/lib.linux-i686-2.3:test/build/lib.linux-i686-2.3:test/build/lib.linux-x86_64-2.3:test/build/lib.linux-i686-2.4:test/build/lib.linux-x86_64-2.4 |
|---|
| 9 | 9 | |
|---|
| 10 | 10 | export LD_LIBRARY_PATH=src/.libs/ |
|---|