为FitNesse CSlim创建夹具有困难



我最近开始使用FitNesse,并试图通过它为C++代码创建验收测试。我最近下载了CSlim,似乎无法使示例fixture正常工作。这是夹具代码的副本:

#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  

我很感激你给我的任何帮助和智慧。

<code>!define TEST_SYSTEM {slim}
!path C:Users212411176DocumentsGit_Repositoriescslim-masterfixtures
!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}

!|import|
|FixtureInCpp.cpp|
|cMultiplication|
|Multiplication1|Multiplication2|Product?|
|1|1|1|
|5|4|20|
|5|4|20|

提前感谢你能给我的任何见解。

干杯,

Alexander

夹具需要更新,请尝试以下夹具

!define TEST_SYSTEM {slim} 
!define TEST_RUNNER {PATH_TO_CSlim}
!define COMMAND_PATTERN {%m} 
!define SLIM_VERSION {0.0} 
!|import|
|FixtureInCpp.cpp|

|Multiplication||被乘数1|被乘数2|乘积||1|1|1||5|4|20||5|4|20|

相关内容

  • 没有找到相关文章

最新更新