added more test cases
This commit is contained in:
17
src/main.c
17
src/main.c
@@ -1,21 +1,36 @@
|
|||||||
#include "states/state.h"
|
#include "states/state.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
Device_t device;
|
Device_t device;
|
||||||
initDevice(&device);
|
initDevice(&device);
|
||||||
// sets the device to off on start up
|
// sets the device to off on start up
|
||||||
setOffState(&device);
|
setDeviceStateToOff(&device);
|
||||||
|
if (strcmp(device.state.state_name, "off_state.c") != 0) return 0;
|
||||||
|
|
||||||
// turn on the device
|
// turn on the device
|
||||||
device.methods.pressPwr(&device);
|
device.methods.pressPwr(&device);
|
||||||
|
if (strcmp(device.state.state_name, "lock_state.c") != 0) return 0;
|
||||||
|
|
||||||
// send the current string
|
// send the current string
|
||||||
device.methods.pressStrInput(&device);
|
device.methods.pressStrInput(&device);
|
||||||
|
if (strcmp(device.state.state_name, "lock_state.c") != 0) return 0;
|
||||||
|
|
||||||
// send in the right string
|
// send in the right string
|
||||||
device.entered_string = "pwd";
|
device.entered_string = "pwd";
|
||||||
device.methods.pressStrInput(&device);
|
device.methods.pressStrInput(&device);
|
||||||
|
if (strcmp(device.state.state_name, "unlock_state.c") != 0) return 0;
|
||||||
|
|
||||||
|
// try to enter debug mode
|
||||||
|
device.entered_string = "dbg";
|
||||||
|
device.methods.pressStrInput(&device);
|
||||||
|
if (strcmp(device.state.state_name, "debug_state.c") != 0) return 0;
|
||||||
|
|
||||||
|
// try to power down
|
||||||
|
device.methods.pressPwr(&device);
|
||||||
|
if (strcmp(device.state.state_name, "off_state.c") != 0) return 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user