I have recently started working with FitNesse and am trying to create Acceptance Tests for C++ code through it. I have recently downloaded CSlim and seem to be unable to get the example fixtures to work. Here is a copy of the fixture code:
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "SlimList.h"
#include "Fixtures.h"
class cMultiplication
{
public:
cMultiplication(){};
~cMultiplication(){};
float product()
{
return m1*m2;
}
float m1;
float m2;
char result[32];
};
#ifndef CPP_COMPILING
extern "C" {
#endif
typedef struct Multiplication
{
cMultiplication multiplication;
char result[32];
} Multiplication;
void* Multiplication_Create(StatementExecutor* errorHandler, SlimList* args)
{
Multiplication* self = (Multiplication*)malloc(sizeof(Multiplication));
self->result[0] = 0;
// self->multiplication = new cMultiplication();
return self;
}
void Multiplication_Destroy(void* void_self)
{
Multiplication* self = (Multiplication*)void_self;
// delete self->multiplication;
free(self);
}
static char* setMultiplicand1(void* void_self, SlimList* args) {
Multiplication* self = (Multiplication*)void_self;
self->multiplication.m1 = atof(SlimList_GetStringAt(args, 0));
return self->result;
}
static char* setMultiplicand2(void* void_self, SlimList* args) {
Multiplication* self = (Multiplication*)void_self;
self->multiplication.m2 = atof(SlimList_GetStringAt(args, 0));
return self->result;
}
static char* Product(void* void_self, SlimList* args) {
Multiplication* self = (Multiplication*)void_self;
float product = self->multiplication.product();
snprintf(self->result, 32, "%g", product);
return self->result;
}
SLIM_CREATE_FIXTURE(Multiplication)
SLIM_FUNCTION(setMultiplicand1)
SLIM_FUNCTION(setMultiplicand2)
SLIM_FUNCTION(Product)
SLIM_END
#ifndef CPP_COMPILING
}
#endif
I would appreicate any help and wisdom that you have to give me.
<code>!define TEST_SYSTEM {slim}
!path C:\Users\212411176\Documents\Git_Repositories\cslim-master\fixtures\
!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}
!|import|
|FixtureInCpp.cpp|
|cMultiplication|
|Multiplication1|Multiplication2|Product?|
|1|1|1|
|5|4|20|
|5|4|20|
Thanks In Advance for any insight you can give me.
Cheers,
Alexander
The fixture needs to be updated, try following fixture
!define TEST_SYSTEM {slim}
!define TEST_RUNNER {PATH_TO_CSlim}
!define COMMAND_PATTERN {%m}
!define SLIM_VERSION {0.0}
!|import|
|FixtureInCpp.cpp|
|Multiplication|
|Multiplicand1|Multiplicand2|Product?|
|1|1|1|
|5|4|20|
|5|4|20|