A python test example

3 years after

{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf470 {\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} {*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{*\levelmarker {disc}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1} {\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{*\levelmarker {disc}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid2}} {*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} \margl1440\margr1440\vieww22140\viewh13600\viewkind0 \deftab720 \pard\pardeftab720

\f0\b\fs24 \cf0 Objective: \b0 Develop a test program and a list of tests which verifies the correctness of the\ libcurl API.\ \ The goal of this task is to verify that the libcurl API works correctly as expected. Specifically,\ your program will be passed a test script through stdin with each line containing at least one\ URL:\ \ \pard\pardeftab720

\i \cf0 <...>\

\i0 \ Where\ \pard\tx220\tx720\pardeftab720\li720\fi-720 \ls1\ilvl0 \fs20 \cf0 {\listtext \'95 } \fs24 startTime is the time to start the fetch in ms (relative to the start of the program, so 0 means immediately on program start).\ \ls1\ilvl0 \fs20 {\listtext \'95 } \fs24 URL is the URL of the object fetched. Only http URLs will be given and there will be no whitespace in the URL.\ \ls1\ilvl0 \fs20 {\listtext \'95 } \fs24 more parameters which are required or helpful for the results of your tests\ \pard\pardeftab720 \cf0 \ So the line\ \

\i 500 \i0 \ \ specifies that 500ms after the program begins execution, a fetch of should be initiated \fs20 .\

\fs24 \ Your program should read lines until it encounters a blank line or EOF.\ \ One test line is considered to have passed if the expected result (fetched page, expected error code) was met. If the result does not meet the expectation it is considered to have failed.\ \ Your program must be implemented in C++ or in Python. If you choose C++ it must perform these fetches using the libcurl-multi interface described at If you choose Python it must perform these fetches using the CurlMulti Object which is described at\ \ When finished, your program should output one line of results per fetch, formatted as:\ \

\i <line#> <PASS|FAIL> \i0 \

\i <...> \i0 \ \ Where\ \pard\tx220\tx720\pardeftab720\li720\fi-720 \ls2\ilvl0 \fs20 \cf0 {\listtext \'95 } \fs24 line# is the line number the fetch was found on (counting from 0)\ \ls2\ilvl0 \fs20 {\listtext \'95 } \fs24 PASS|FAIL is the text PASS or FAIL\ \ls2\ilvl0 \fs20 {\listtext \'95 } \fs24 fetchTime is the amount of time in ms the operation took to complete (or report an error)\ \ls2\ilvl0 \fs20 {\listtext \'95 } \fs24 URL is the URL that was specified in the input\ \ls2\ilvl0 \fs20 {\listtext \'95 } \fs24 libcurl explanation is the output of curl_easy_strerror() on the returned status\ \ls2\ilvl0 \fs20 {\listtext \'95 } \fs24 ... potentially more parameters which are helpful to understand the test result\ \pard\pardeftab720 \cf0 \ Your solution should consist of the source code of your program to execute the tests as well\ as a single test script (as described above) to be fed into your program to demonstrate its\ abilities.}