Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs3-24sp
solo04
Commits
266f7f5f
Commit
266f7f5f
authored
4 months ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
Update test_server.c
parent
03e434fa
master
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_server.c
+27
-0
tests/test_server.c
with
27 additions
and
0 deletions
+27
-0
tests/test_server.c
View file @
266f7f5f
...
...
@@ -5,6 +5,32 @@
#include "network_util.h"
#include "server_test_util.h"
void
test_long
(
const
char
*
bin
,
int
port
)
{
server_handle_t
*
h
=
server_spawn
(
bin
,
port
);
const
char
REQUEST
[]
=
"GET /hello HTTP/1.1
\r\n
"
"Host: labradoodle.caltech.edu:10918
\r\n
"
"Cookie: _ga_R0G8HH0FKW=GS1.1.1744078038.1.1.1744079446.0.0.0; _ga_RHR25JXBQM=GS1.1.1744313683.1.1.1744313703.0.0.0; _ga_ZJLTP8D04M=GS1.1.1744313707.1.1.1744314889.0.0.0; _ga_S191CG4HJS=GS1.1.1744841044.1.1.1744841056.0.0.0; _ga_37STWSV9MD=GS1.1.1745034333.2.1.1745034372.0.0.0; _ga_68E24C55CC=GS1.1.1745034384.1.1.1745034463.0.0.0; _ga_ZNBMB6GSNZ=GS1.1.1745622505.1.1.1745622556.0.0.0; _ga_STJ2DN480K=GS1.1.1745622505.1.1.1745622556.0.0.0; _ga_G31WQ82140=GS1.1.1745622563.5.1.1745622636.0.0.0; _ga_9RFYMGV2SS=GS1.1.1745960593.7.0.1745960593.0.0.0; _ga_VJ863GWZ4Z=GS1.1.1746049539.5.1.1746049620.0.0.0; _ga_KDHV30NC26=GS1.1.1746106545.6.1.1746106934.0.0.0; _ga_7RL83EX4D4=GS1.1.1746128897.4.1.1746128899.0.0.0; _ga_EC025HJDTY=GS1.1.1746132827.2.1.1746132828.0.0.0; _ga_ZGEFJLNF3Q=GS1.1.1746150773.1.1.1746150789.0.0.0; _ga_ZH0LRM35DB=GS1.1.1746204046.1.0.1746204056.0.0.0; _ga=GA1.2.1646971239.1743629810; _ga_B6X5N53CTL=GS2.1.s1746220225$o4$g1$t1746220367$j0$l0$h0; _ga_YP15TXTX15=GS1.1.1746220226.4.1.1746220367.0.0.0
\r\n
"
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
\r\n
"
"Accept-Language: en-US,en;q=0.9,nl;q=0.8
\r\n
"
"Connection: keep-alive
\r\n
"
"DNT: 1
\r\n
"
"Upgrade-Insecure-Requests: 1
\r\n
"
"User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
\r\n\r\n
"
;
const
char
EXPECTED
[]
=
"HTTP/1.1 200 OK
\r\n
"
"Content-Type: text/html
\r\n
"
"Content-Length: 12
\r\n
"
"
\r\n
"
"Hello world!"
;
char
*
response
=
server_query
(
h
,
REQUEST
);
char
*
r
=
response
;
char
*
e
=
EXPECTED
;
assert_streq
(
response
,
(
char
*
)
EXPECTED
);
free
(
response
);
server_kill
(
h
);
}
void
test_hello
(
const
char
*
bin
,
int
port
)
{
server_handle_t
*
h
=
server_spawn
(
bin
,
port
);
const
char
REQUEST
[]
=
"GET /hello HTTP/1.1
\r\n\r\n
"
;
...
...
@@ -53,5 +79,6 @@ int main(int argc, char *argv[]) {
DO_TEST
(
test_hello
,
bin
,
port
)
DO_TEST
(
test_multiple
,
bin
,
port
)
DO_TEST
(
test_long
,
bin
,
port
)
puts
(
"test_server PASS"
);
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help