Blame view

test/DD_Client/CSlimFixtures/ScriptTableExample.c 1.03 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

#include "CSlim/Fixtures.h"
#include "CSlim/SlimList.h"

47539b45   Benjamin Renard   Remove some warni...
8
9
#define UNUSED(x) (void)(x)

fbe3c2bb   Benjamin Renard   First commit
10
11
12
13
14
15
16
17
18
19
typedef struct ConnectToDDServer2
{
	int count;
	char *user;
	char *passwd;
	char result[32];
} ConnectToDDServer2;

void* ConnectToDDServer2_Create(StatementExecutor* errorHandler, SlimList* args)
{
47539b45   Benjamin Renard   Remove some warni...
20
21
	UNUSED(errorHandler);
	UNUSED(args);
fbe3c2bb   Benjamin Renard   First commit
22
23
24
25
26
27
28
29
30
31
32
	ConnectToDDServer2* self = (ConnectToDDServer2*)malloc(sizeof(ConnectToDDServer2));
	memset(self, 0, sizeof(ConnectToDDServer2));
	return self;
}

void ConnectToDDServer2_Destroy(void* self)
{
	free(self);
}

static char* login(void* void_self, SlimList* args) {
47539b45   Benjamin Renard   Remove some warni...
33
	UNUSED(args);
fbe3c2bb   Benjamin Renard   First commit
34
35
36
37
38
39
	ConnectToDDServer2* self = (ConnectToDDServer2*)void_self;
	self->count++;
	return "";
}

static char* simpleTest(void* void_self, SlimList* args) {
47539b45   Benjamin Renard   Remove some warni...
40
	UNUSED(args);
fbe3c2bb   Benjamin Renard   First commit
41
42
43
44
45
46
47
48
49
50
	ConnectToDDServer2* self = (ConnectToDDServer2*)void_self;
	snprintf(self->result, 32, "%d", 0);
	return self->result;
}


SLIM_CREATE_FIXTURE(ConnectToDDServer2)
	SLIM_FUNCTION(login)
	SLIM_FUNCTION(simpleTest)
SLIM_END