firmware
v0.1.2
Chromation Spectrometer Dev-Kit
mock-c
code
Mock.h
1
#ifndef _MOCK_H
2
#define _MOCK_H
3
4
#include "RecordedCall.h"
// RecordedCall
5
#include "RecordedArg.h"
// RecordedArg
6
#include <stdbool.h>
// bool, true, false
7
8
//=====[ mock-c Mock datatype ]=====
9
typedef
struct
Mock_s
Mock_s
;
10
extern
Mock_s
*mock;
// memory allocated in the test runner
11
Mock_s
* Mock_new(
void
);
12
void
Mock_destroy(
Mock_s
*
self
);
13
void
RecordExpectedCall(
Mock_s
*
self
,
RecordedCall
*func_call);
14
void
RecordActualCall(
Mock_s
*
self
,
RecordedCall
*func_call);
15
void
RecordArg(
RecordedCall
*
self
,
RecordedArg
*input_arg);
16
void
PrintAllCalls(
Mock_s
*
self
);
// Example
17
// copied from old mock-c
18
bool
RanAsHoped(
Mock_s
*
self
);
19
char
const
* WhyDidItFail(
Mock_s
*
self
);
20
/* =====[ New functionality I added 2018 August ]===== */
21
char
const
* ListAllCalls(
Mock_s
*
self
);
// alternate to WhyDidItFail()
22
/* =====[ New functionality I added 2019 October ]===== */
23
/* bool AssertCall(Mock_s *mock, uint8_t call_number, char * call_name); */
24
bool
SilentAssertCall(
Mock_s
*mock, uint16_t call_number,
char
const
* call_name);
25
bool
AssertCall(
Mock_s
*mock, uint16_t call_number,
char
const
* call_name);
26
bool
AssertArg(
27
Mock_s
*mock,
28
uint16_t call_number,
29
uint8_t arg_number,
30
void
*p_assert_val
31
);
32
bool
AssertArgPointsToValue(
33
Mock_s
*
self
,
34
uint8_t call_n,
35
uint8_t arg_k,
36
void
*p_assert_val
37
);
38
uint16_t NumberOfActualCalls(
Mock_s
*mock);
39
40
#endif
// _MOCK_H
Mock_s
Definition:
Mock.c:5
RecordedArg
Definition:
RecordedArg.h:30
RecordedCall
Definition:
RecordedCall.h:8
Generated by
1.9.1