Configure test extension for vscode

This commit is contained in:
2022-11-27 14:55:06 +01:00
parent 363c9568a7
commit e67c12358f
8 changed files with 102 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.10)
set(TEST_NAME cmd_parser)
set(TEST_NAME cmd_parser_test)
set(INCLUDE_DIRS
../../cmd_parser

View File

@@ -12,9 +12,10 @@ void tearDown(void)
{
}
void test_one(void)
void test_CommandDetetection(void)
{
TEST_FAIL();
TEST_ASSERT(1==1);
}
@@ -22,7 +23,7 @@ void test_one(void)
int main(void)
{
UNITY_BEGIN();
RUN_TEST(test_one);
RUN_TEST(test_CommandDetetection);
return UNITY_END();
}

View File

@@ -0,0 +1,3 @@
#pragma once
#include <stdint.h>

View File

@@ -0,0 +1,42 @@
#include "main.h"
#include "cmd_parser.h"
/*
Usage: led set|get [-p PNUM | --power=PNUM] [-w CHOICES | --which=CHOICES] [-m COICES | --mode=CHOICES]
-p, --power set or get power 0-100
-w, --which set or get specific leds [Atop, Abot, Btop, Bbot, Ctop, Cbot, all]
-m, --mode set or get mode of operation [allways_on, scan]
*/
typedef enum
{
get,
set,
} led_action_t;
typedef enum
{
Atop = (1 << 0),
Abot = (1 << 1),
Btop = (1 << 2),
Bbot = (1 << 3),
Ctop = (1 << 4),
Cbot = (1 << 5),
all = 0xFF,
} led_leds_t;
typedef enum
{
allways_on,
scan,
} led_mode_t;
typedef struct
{
led_action_t action;
uint8_t power;
led_leds_t leds;
led_mode_t mode;
} led_option_t;
void led_parse_callback(char key, const char *text);