<commit_before>#include <skypat/skypat.h>
#define _Bool bool
extern "C" {
#include <dataTypes/Value.h>
#include <core/Runtime.h>
#include <instance/MemInst.h>
#include <string.h>
#include <stdint.h>
}
#undef _Bool
SKYPAT_F(runtime_i32_load8_s, regular)
{
    // Prepare
    Stack* stack = new_Stack();
    MemInst* memory = new_MemInst();
    memory->max = 1;
    int32_t data[] = { 0, 1, -1, 4, -4, 16, -16, 64, -64, 256, -256, 518, -518, 1040, -1024 };
    uint32_t byteLen = sizeof(data);
    uint32_t offset = 4 * sizeof(int32_t);
    uint8_t* bytePtr = (uint8_t*) data;
    uint8_t zero = 0;

    for(int32_t lop = 0; lop < offset; lop++) {
        memory->data->push_back(memory->data, (const void *)&zero);
    }
    for(int32_t lop = 0; lop < byteLen; lop++) {
        memory->data->push_back(memory->data, (const void *)(bytePtr + lop));
    }
    for(uint8_t lop = 0; lop < 8; lop += sizeof(int32_t)) {
        // Set load location
        stack->entries->push(stack->entries, new_i32Value(lop * sizeof(int32_t)));
        // Run
        runtime_i32_load8_s(stack, memory, offset, 0);
        // Check
        Value *check = NULL;
        stack->entries->pop(stack->entries, (void**)&check);
        EXPECT_EQ(check->value.i32, (int8_t)data[lop]);
    }
    // error check
    stack->entries->push(stack->entries, new_i32Value(65540));
    int ret = runtime_i32_load8_u(stack, memory, offset, 0);
    EXPECT_EQ(ret, -1);
    // clean datas
    free_MemInst(memory);
    free_Stack(stack);
}<commit_msg>fix i32_load8_s unittest (#159)<commit_after>#include <skypat/skypat.h>
#define _Bool bool
extern "C" {
#include <dataTypes/Value.h>
#include <core/Runtime.h>
#include <instance/MemInst.h>
#include <string.h>
#include <stdint.h>
}
#undef _Bool
SKYPAT_F(runtime_i32_load8_s, regular)
{
    // Prepare
    Stack* stack = new_Stack();
    MemInst* memory = new_MemInst();
    memory->max = 1;
    int32_t data[] = { 0, 1, -1, 4, -4, 16, -16, 64, -64, 256, -256, 518, -518, 1040, -1024 };
    uint32_t byteLen = sizeof(data);
    uint32_t offset = 4 * sizeof(int32_t);
    uint8_t* bytePtr = (uint8_t*) data;
    uint8_t zero = 0;

    for(int32_t lop = 0; lop < offset; lop++) {
        memory->data->push_back(memory->data, (const void *)&zero);
    }
    for(int32_t lop = 0; lop < byteLen; lop++) {
        memory->data->push_back(memory->data, (const void *)(bytePtr + lop));
    }
    for(uint8_t lop = 0; lop < 8; lop += sizeof(int32_t)) {
        // Set load location
        stack->entries->push(stack->entries, new_i32Value(lop * sizeof(int32_t)));
        // Run
        runtime_i32_load8_s(stack, memory, offset, 0);
        // Check
        Value *check = NULL;
        stack->entries->pop(stack->entries, (void**)&check);
        EXPECT_EQ(check->value.i32, (int8_t)data[lop]);
    }
    // error check
    stack->entries->push(stack->entries, new_i32Value(65540));
    int ret = runtime_i32_load8_s(stack, memory, offset, 0);
    EXPECT_EQ(ret, -1);
    // clean datas
    free_MemInst(memory);
    free_Stack(stack);
}
{'fraction_non_alphanumeric': 0.16798159105851412, 'fraction_numerical': 0.05719921104536489, 'mean_word_length': 3.0039473684210525, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, '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': '4820566', 'n_tokens_mistral': 1275, 'n_tokens_neox': 1162, 'n_words': 251}