<commit_before>/*
 * =====================================================================================
 *
 *       Filename:  TestDelaySetFunction.c
 *
 *    Description:  Test the simple function
 *
 *        Version:  1.0
 *        Created:  2014.10.23 23:11:44
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  YOUR NAME (), 
 *   Organization:  
 *
 * =====================================================================================
 */
#include "unity.h"
#include <stdint.h>
#include "FakeArduino.h"
#include "Spectrometer.h"


void setUp(void)
{
}
 
void tearDown(void)
{
}
 
void test_spectrometr_initializes_needed_pins_to_output(void) {
        Spectrometer_init();
        TEST_ASSERT_TRUE(get_pinMode(MS1) == OUT);
        TEST_ASSERT_TRUE(get_pinState(MS1) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(MS2) == OUT);
        TEST_ASSERT_TRUE(get_pinState(MS2) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(DIR) == OUT);
        TEST_ASSERT_TRUE(get_pinState(DIR) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(STEP) == OUT);
        TEST_ASSERT_TRUE(get_pinState(STEP) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(HOME) == OUT);
        TEST_ASSERT_TRUE(get_pinState(HOME) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(BUSY) == OUT);
        TEST_ASSERT_TRUE(get_pinState(BUSY) == LOW);
}

void test_spectrometer_command_parsing_works_correctly(void) {
        uint32_t cmd = 0xFFFFFFF1;
        TEST_ASSERT_TRUE(Spectrometer_parse(cmd) == 1);
}

void test_spectrometer_can_set_and_clear_busy_flag(void) {
        Spectrometer_busy_set();
        TEST_ASSERT_TRUE(get_pinState(BUSY) == HIGH);
        Spectrometer_busy_clear();
        TEST_ASSERT_TRUE(get_pinState(BUSY) == LOW);
}<commit_msg>Smallest step size is set by default at start<commit_after>/*
 * =====================================================================================
 *
 *       Filename:  TestDelaySetFunction.c
 *
 *    Description:  Test the simple function
 *
 *        Version:  1.0
 *        Created:  2014.10.23 23:11:44
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  YOUR NAME (), 
 *   Organization:  
 *
 * =====================================================================================
 */
#include "unity.h"
#include <stdint.h>
#include "FakeArduino.h"
#include "Spectrometer.h"


void setUp(void)
{
}
 
void tearDown(void)
{
}
 
void test_spectrometr_initializes_needed_pins_to_output(void) {
        Spectrometer_init();
        TEST_ASSERT_TRUE(get_pinMode(MS1) == OUT);
        TEST_ASSERT_TRUE(get_pinState(MS1) == HIGH);
        TEST_ASSERT_TRUE(get_pinMode(MS2) == OUT);
        TEST_ASSERT_TRUE(get_pinState(MS2) == HIGH);
        TEST_ASSERT_TRUE(get_pinMode(DIR) == OUT);
        TEST_ASSERT_TRUE(get_pinState(DIR) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(STEP) == OUT);
        TEST_ASSERT_TRUE(get_pinState(STEP) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(HOME) == OUT);
        TEST_ASSERT_TRUE(get_pinState(HOME) == LOW);
        TEST_ASSERT_TRUE(get_pinMode(BUSY) == OUT);
        TEST_ASSERT_TRUE(get_pinState(BUSY) == LOW);
}

void test_spectrometer_command_parsing_works_correctly(void) {
        uint32_t cmd = 0xFFFFFFF1;
        TEST_ASSERT_TRUE(Spectrometer_parse(cmd) == 1);
}

void test_spectrometer_can_set_and_clear_busy_flag(void) {
        Spectrometer_busy_set();
        TEST_ASSERT_TRUE(get_pinState(BUSY) == HIGH);
        Spectrometer_busy_clear();
        TEST_ASSERT_TRUE(get_pinState(BUSY) == LOW);
}
{'fraction_non_alphanumeric': 0.20581527936145952, 'fraction_numerical': 0.014253135689851768, 'mean_word_length': 3.813443072702332, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2724526', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1162, 'n_words': 158}