#include "includes.h"

int main(void) {
    tdQueue* queue = queue_create();
    printf("queue is empty? %i\n", queue_is_empty(queue));
    printf("ptr - %p %p\n", queue_peek(queue), queue_dequeue(queue));
    matrix2d* mat = create_matrix2d(2, 2);
    int temp = -1;
    rgbled* led = create_led(); 
    for (int y = 0; y < mat->y; y++)
        for (int x = 0; x < mat->x; x++) {
            led = create_led();
            while(scanf("%d", &temp) != 1 || temp < 0 || temp >= 511000) continue;
            set_Temp(led, temp);
            set_elem_matrix2d(mat, (void*)led, x, y);
            temp = -1;
        }
    queue_enqueue(queue, mat);
    printf("queue is empty? %i\n", queue_is_empty(queue));
    printf("Size queue? %i (%i)\n", queue_size(queue), queue->capacity);
    print_matrix2d(queue_peek(queue));
    for (int i = 0; i < 500000; i++) {
        mat = create_matrix2d(10, 10);
        fill_rand_matrix2d(mat);
        queue_enqueue(queue, mat);
    }
    printf("Size queue? %i (%i)\n", queue_size(queue), queue->capacity);
    mat = queue_dequeue(queue);
    print_matrix2d(mat);
    deconstruct_matrix2d(mat);
    printf("Size queue? %i (%i)\n", queue_size(queue), queue->capacity);
    tdQueue* queue_b = queue_create();
    for (int i = 0; i < 500000; i++) {
        mat = create_matrix2d(10, 10);
        fill_rand_matrix2d(mat);
        queue_enqueue(queue_b, mat);
    }
    printf("Size queue_b? %i (%i)\n", queue_size(queue_b), queue_b->capacity);
    queue_decontruct(queue);
    queue_decontruct(queue_b);
    return 0;
}
