~cpick/mongrel2/release

« back to all changes in this revision

Viewing changes to tests/connection_tests.c

  • Committer: Chris Pick
  • Date: 2013-06-30 16:39:57 UTC
  • mfrom: (1106.1.15)
  • Revision ID: git-v1:ec39967acb6bc9867ed9b9dc3774304ca6b9c294
Merge tag 'v1.8.1' into debian

Hotfix for github issue 148

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#include <unistd.h>
4
4
#include <sys/types.h>
5
5
#include <fcntl.h>
6
 
#include <zmq.h>
 
6
#include "zmq_compat.h"
7
7
#include <task/task.h>
8
8
#include <dir.h>
9
9
 
20
20
    return NULL;
21
21
}
22
22
 
23
 
char *test_Connection_deliver()
24
 
{
25
 
    bstring t1;
26
 
    const char remote[IPADDR_SIZE];
27
 
    Connection *conn = Connection_create(NULL, 1, 0, remote);
28
 
    mu_assert(conn != NULL, "Failed to create a connection.");
29
 
 
30
 
    int rc = Connection_deliver(conn, t1 = bfromcstr("TEST"));
31
 
    // depending on the platform this will fail or not if send is allowed on files
32
 
    mu_assert(rc == -1, "Should NOT be able to write.");
33
 
 
34
 
    Connection_destroy(conn);
35
 
    bdestroy(t1);
36
 
 
37
 
    return NULL;
38
 
}
39
 
 
40
23
int test_task_with_sample(const char *sample_file)
41
24
{
 
25
    (void)sample_file;
 
26
 
42
27
    check(SRV, "Server isn't configured.");
43
28
 
44
29
    Connection *conn = Connection_create(SRV, 12, 1400, "127.0.0.1");
97
82
    Server_set_default_host(SRV, zedshaw_com);
98
83
 
99
84
    mu_run_test(test_Connection_create_destroy);
100
 
    mu_run_test(test_Connection_deliver);
101
85
    mu_run_test(test_Connection_task);
102
86
 
103
87
    Server_destroy(SRV);
108
92
}
109
93
 
110
94
RUN_TESTS(all_tests);
111