Skip to content
Snippets Groups Projects
Commit 16de0b55 authored by TwilCynder's avatar TwilCynder
Browse files

moved the basic test bc didnt feel like deleting it

parent 7bd3c2d9
No related branches found
No related tags found
No related merge requests found
#include "../execution.h"
#include "test.h"
char *const e1args[] = {path, "-f", "3", "-t", "3", 0};
typedef struct {
int number;
} TestState;
void test_initialize(void **state, void *context)
{
TestState *newtstate = (TestState *) malloc(sizeof(TestState));
newtstate->number = 100;
*state = (void *) newtstate;
}
void test_read(void *state, void *context, const char *buffer, int nread)
{
printf("Out : %s", buffer);
if (nread < BUFFER_SIZE) {
((TestState *)state)->number += 1;
}
}
int test_finalize(void *state, void *context)
{
return ((TestState *)state)->number;
}
void test_test(){
Tester test_tester = {
.init = test_initialize,
.read = test_read,
.finalize = test_finalize,
.name = "Test"
};
Execution e1 = {
.args = e1args,
.testers = &test_tester,
.nb_testers = 1
};
execute_test(&e1);
}
\ No newline at end of file
#pragma once
void test_test();
\ No newline at end of file
...@@ -8,52 +8,14 @@ ...@@ -8,52 +8,14 @@
#include "execution.h" #include "execution.h"
#include "executions/timing.h" #include "executions/timing.h"
#include "executions/test.h"
char *const e1args[] = {path, "-f", "3", "-t", "3", 0};
typedef struct {
int number;
} TestState;
void test_initialize(void **state, void *context)
{
TestState *newtstate = (TestState *) malloc(sizeof(TestState));
newtstate->number = 100;
*state = (void *) newtstate;
}
void test_read(void *state, void *context, const char *buffer, int nread)
{
printf("Out : %s", buffer);
if (nread < BUFFER_SIZE) {
((TestState *)state)->number += 1;
}
}
int test_finalize(void *state, void *context)
{
return ((TestState *)state)->number;
}
char path[] = "../bin/mojitos"; char path[] = "../bin/mojitos";
int main(int argc, char const *argv[]) int main(int argc, char const *argv[])
{ {
Tester test_tester = {
.init = test_initialize,
.read = test_read,
.finalize = test_finalize,
.name = "Test"
};
Execution e1 = {
.args = e1args,
.testers = &test_tester,
.nb_testers = 1
};
execute_test(&e1);
test_test();
timing_test(); timing_test();
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment