From 7196d784d330df3030b782e097799629f4b80a61 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 12 Dec 2002 12:11:16 +0000 Subject: [PATCH] The first ever attempts to do pure libcurl test cases --- tests/libtest/Makefile.am | 20 ++++++++++++++++++++ tests/libtest/first.c | 10 ++++++++++ tests/libtest/last.c | 1 + tests/libtest/lib500.c | 12 ++++++++++++ tests/libtest/lib501.c | 13 +++++++++++++ 5 files changed, 56 insertions(+) create mode 100644 tests/libtest/Makefile.am create mode 100644 tests/libtest/first.c create mode 100644 tests/libtest/last.c create mode 100644 tests/libtest/lib500.c create mode 100644 tests/libtest/lib501.c diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am new file mode 100644 index 000000000..d172b2abd --- /dev/null +++ b/tests/libtest/Makefile.am @@ -0,0 +1,20 @@ +# +# $Id$ +# + +AUTOMAKE_OPTIONS = foreign nostdinc + +INCLUDES = -I$(top_srcdir)/include + +LIBDIR = ../../lib + +# here are all tools used for running libcurl tests +bin_PROGRAMS = lib500 lib501 + +lib500_SOURCES = lib500.c +lib500_LDADD = $(LIBDIR)/libcurl.la +lib500_DEPENDENCIES = $(LIBDIR)/libcurl.la + +lib501_SOURCES = lib501.c +lib501_LDADD = $(LIBDIR)/libcurl.la +lib501_DEPENDENCIES = $(LIBDIR)/libcurl.la diff --git a/tests/libtest/first.c b/tests/libtest/first.c new file mode 100644 index 000000000..303766fc8 --- /dev/null +++ b/tests/libtest/first.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char **argv) +{ + if(argc< 2 ) { + fprintf(stderr, "Pass URL as argument please\n"); + return 1; + } + + curl_memdebug("memdump"); diff --git a/tests/libtest/last.c b/tests/libtest/last.c new file mode 100644 index 000000000..5c34318c2 --- /dev/null +++ b/tests/libtest/last.c @@ -0,0 +1 @@ +} diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c new file mode 100644 index 000000000..a825b930c --- /dev/null +++ b/tests/libtest/lib500.c @@ -0,0 +1,12 @@ +#include "first.c" + +fprintf(stderr, "URL: %s\n", argv[1]); + +CURL *curl; +curl = curl_easy_init(); +curl_easy_setopt(curl, CURLOPT_URL, argv[1]); +curl_easy_setopt(curl, CURLOPT_HEADER, TRUE); +curl_easy_perform(curl); +curl_easy_cleanup(curl); + +#include "last.c" diff --git a/tests/libtest/lib501.c b/tests/libtest/lib501.c new file mode 100644 index 000000000..4199598fa --- /dev/null +++ b/tests/libtest/lib501.c @@ -0,0 +1,13 @@ +#include "first.c" + +fprintf(stderr, "URL: %s\n", argv[1]); + +CURL *curl; +CURLcode res; +curl = curl_easy_init(); +curl_easy_setopt(curl, CURLOPT_HEADER, TRUE); +res = curl_easy_perform(curl); +curl_easy_cleanup(curl); + +return res; +#include "last.c"