Libraries os, string, number e vector (listas); pastas e booleanos no fs
- tinyblocks-fs: itens da pasta (lista), quantidade/item N da pasta e os booleanos "é arquivo?", "é pasta?" e "existe?". - tinyblocks-os (categoria Sistema): sistema operacional, distribuição, versão do kernel, arquitetura, computador, usuário, pastas, CPUs, memória, tempo ligado e "o sistema é [ ]?". - tinyblocks-string (Texto): maiúsculas/minúsculas, trecho, letra N, posição, troca, apara, repete, inverte, divide em lista e testes; conta letras UTF-8. - tinyblocks-number (Números): reais, potência, raiz, arredondamentos, trigonometria em graus, logaritmos, pi, aleatório, limite, formatação, par/primo/inteiro. - tinyblocks-vector (Listas, blocos List.*): listas JSON imutáveis com adicionar, inserir, remover, trocar, item N, posição, fatia, ordenar, juntar, soma; campos aceitam "[1,2]" ou "a, b". O exemplo de desenho vetorial passa a se chamar tinyblocks-vector-draw. - Editor: saída única cujo nome termina em '?' vira bloco booleano (hexágono); listas JSON aparecem como texto no "escreva"; rótulos PT. - Testes: make test-os e make test-stdlib. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f0abc7593a
commit
33705b2903
25 files changed
+2262
-9
No files matched your search
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* os_fs_test.c - testa tinyblocks-os (informacoes do sistema) e os blocos
|
||||
* de pasta do tinyblocks-fs (FS.ListDir / ListCount / ListItem / IsFile /
|
||||
* IsDir / Exists).
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
#include <tinyblocks/tb_json_block.h>
|
||||
#include <tb_fs.h>
|
||||
#include <tb_os.h>
|
||||
|
||||
static int fails = 0;
|
||||
#define CHECK(c, m) do { if (c) printf("ok %s\n", m); else { printf("FAIL %s\n", m); fails++; } } while (0)
|
||||
|
||||
static TinyBlocks* rt;
|
||||
|
||||
/* Cria o bloco, preenche as entradas (texto/inteiro) e avalia */
|
||||
static TinyBlocks_Block* run(const char* type, const char* a, long long b) {
|
||||
TinyBlocks_TypeBlock* t = tb_rt_find_type(rt, type);
|
||||
if (!t) return NULL;
|
||||
TinyBlocks_Block* blk = tb_block_create(rt, t);
|
||||
if (a) {
|
||||
TinyBlocks_Value v = tb_value_text(a);
|
||||
tb_block_set_default(blk, 0, v);
|
||||
tb_value_free(&v);
|
||||
}
|
||||
if (b >= 0) {
|
||||
TinyBlocks_Value v = tb_value_integer(b);
|
||||
tb_block_set_default(blk, 1, v);
|
||||
tb_value_free(&v);
|
||||
}
|
||||
tb_block_eval(blk, rt);
|
||||
return blk;
|
||||
}
|
||||
|
||||
static long long out_int(TinyBlocks_Block* b) {
|
||||
return (b && b->outputs[0].kind == TB_VALUE_INTEGER) ? b->outputs[0].as.integer : -1;
|
||||
}
|
||||
static const char* out_text(TinyBlocks_Block* b) {
|
||||
return (b && b->outputs[0].kind == TB_VALUE_TEXT && b->outputs[0].as.text) ? b->outputs[0].as.text : "";
|
||||
}
|
||||
|
||||
static void touch(const char* p) {
|
||||
FILE* f = fopen(p, "wb");
|
||||
if (f) { fputs("x", f); fclose(f); }
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
tinyblocks_init(&rt, NULL);
|
||||
TinyBlocks_LibraryBlock* fs = tb_library_register(rt, tb_fs_get_library());
|
||||
TinyBlocks_LibraryBlock* os = tb_library_register(rt, tb_os_get_library());
|
||||
CHECK(fs && os, "libraries fs e os registradas");
|
||||
const TinyBlocks_Category* cat = os ? tb_library_category(os) : NULL;
|
||||
CHECK(cat && !strcmp(cat->name, "Sistema"), "categoria 'Sistema'");
|
||||
|
||||
/* -- tinyblocks-os -- */
|
||||
char buf[512];
|
||||
tb_os_name(buf, sizeof(buf));
|
||||
CHECK(buf[0], "tb_os_name devolve um nome");
|
||||
TinyBlocks_Block* b = run("OS.Name", NULL, -1);
|
||||
CHECK(!strcmp(out_text(b), buf), "OS.Name igual a tb_os_name");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.Distro", NULL, -1);
|
||||
CHECK(out_text(b)[0], "OS.Distro devolve texto");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.Version", NULL, -1);
|
||||
CHECK(out_text(b)[0], "OS.Version devolve a versao do kernel");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.Arch", NULL, -1);
|
||||
CHECK(out_text(b)[0], "OS.Arch devolve a arquitetura");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.User", NULL, -1);
|
||||
CHECK(out_text(b)[0], "OS.User devolve o usuario");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.Cpus", NULL, -1);
|
||||
CHECK(out_int(b) >= 1, "OS.Cpus >= 1");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.MemoryMB", NULL, -1);
|
||||
CHECK(out_int(b) > 0, "OS.MemoryMB > 0");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.Is", buf, -1);
|
||||
CHECK(out_int(b) == 1, "OS.Is(nome do SO) verdadeiro");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("OS.Is", "SistemaQueNaoExiste", -1);
|
||||
CHECK(out_int(b) == 0, "OS.Is(outro) falso");
|
||||
tb_block_destroy(b, rt);
|
||||
TinyBlocks_TypeBlock* tis = tb_rt_find_type(rt, "OS.Is");
|
||||
CHECK(tis && tis->output_desc_count == 1 &&
|
||||
tis->output_descs[0].name[strlen(tis->output_descs[0].name) - 1] == '?',
|
||||
"OS.Is declara saida booleana ('?')");
|
||||
|
||||
/* -- tinyblocks-fs: pastas -- */
|
||||
char dir[] = "/tmp/tb_osfs_XXXXXX";
|
||||
CHECK(mkdtemp(dir) != NULL, "pasta temporaria");
|
||||
char p[256];
|
||||
snprintf(p, sizeof(p), "%s/b.txt", dir); touch(p);
|
||||
snprintf(p, sizeof(p), "%s/A.json", dir); touch(p);
|
||||
snprintf(p, sizeof(p), "%s/sub", dir); mkdir(p, 0755);
|
||||
|
||||
b = run("FS.ListCount", dir, -1);
|
||||
CHECK(out_int(b) == 3, "FS.ListCount = 3");
|
||||
tb_block_destroy(b, rt);
|
||||
|
||||
b = run("FS.ListDir", dir, -1);
|
||||
bool list_ok = b && b->outputs[0].kind == TB_VALUE_JSON;
|
||||
if (list_ok) {
|
||||
TinyBlocks_JsonValue* arr = b->outputs[0].as.json;
|
||||
list_ok = tb_json_array_length(arr) == 3;
|
||||
TinyBlocks_JsonValue* first = list_ok ? tb_json_array_get(arr, 0) : NULL;
|
||||
list_ok = list_ok && first && !strcmp(tb_json_as_string(first), "A.json");
|
||||
if (first) tb_json_release(first);
|
||||
}
|
||||
CHECK(list_ok, "FS.ListDir devolve lista ordenada [A.json, b.txt, sub]");
|
||||
tb_block_destroy(b, rt);
|
||||
|
||||
b = run("FS.ListItem", dir, 2);
|
||||
CHECK(!strcmp(out_text(b), "b.txt"), "FS.ListItem(2) = b.txt");
|
||||
tb_block_destroy(b, rt);
|
||||
b = run("FS.ListItem", dir, 9);
|
||||
CHECK(!strcmp(out_text(b), ""), "FS.ListItem fora da faixa = vazio");
|
||||
tb_block_destroy(b, rt);
|
||||
|
||||
snprintf(p, sizeof(p), "%s/b.txt", dir);
|
||||
b = run("FS.IsFile", p, -1); CHECK(out_int(b) == 1, "FS.IsFile(arquivo) verdadeiro"); tb_block_destroy(b, rt);
|
||||
b = run("FS.IsDir", p, -1); CHECK(out_int(b) == 0, "FS.IsDir(arquivo) falso"); tb_block_destroy(b, rt);
|
||||
b = run("FS.Exists", p, -1); CHECK(out_int(b) == 1, "FS.Exists(arquivo) verdadeiro"); tb_block_destroy(b, rt);
|
||||
remove(p);
|
||||
snprintf(p, sizeof(p), "%s/sub", dir);
|
||||
b = run("FS.IsDir", p, -1); CHECK(out_int(b) == 1, "FS.IsDir(pasta) verdadeiro"); tb_block_destroy(b, rt);
|
||||
b = run("FS.IsFile", p, -1); CHECK(out_int(b) == 0, "FS.IsFile(pasta) falso"); tb_block_destroy(b, rt);
|
||||
rmdir(p);
|
||||
snprintf(p, sizeof(p), "%s/A.json", dir);
|
||||
remove(p);
|
||||
b = run("FS.Exists", p, -1); CHECK(out_int(b) == 0, "FS.Exists(apagado) falso"); tb_block_destroy(b, rt);
|
||||
rmdir(dir);
|
||||
|
||||
tinyblocks_deinit(&rt);
|
||||
if (fails) printf("\n%d FALHA(S)\n", fails);
|
||||
else printf("\nTUDO OK\n");
|
||||
return fails != 0;
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
/*
|
||||
* stdlib_test.c - testa tinyblocks-string (Texto), tinyblocks-number
|
||||
* (Números) e tinyblocks-vector (Listas) pelos blocos, como o editor usa.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <tinyblocks/tinyblocks.h>
|
||||
#include <tinyblocks/tb_json_block.h>
|
||||
#include <tb_string.h>
|
||||
#include <tb_number.h>
|
||||
#include <tb_vector.h>
|
||||
|
||||
static int fails = 0;
|
||||
#define CHECK(c, m) do { if (c) printf("ok %s\n", m); else { printf("FAIL %s\n", m); fails++; } } while (0)
|
||||
|
||||
static TinyBlocks* rt;
|
||||
static TinyBlocks_Block* last;
|
||||
|
||||
/* Avalia `type` com ate 3 entradas dadas como texto (NULL = vazio).
|
||||
O texto e convertido como o editor faz com um campo digitado. */
|
||||
static TinyBlocks_Value* run(const char* type, const char* a, const char* b, const char* c) {
|
||||
if (last) { tb_block_destroy(last, rt); last = NULL; }
|
||||
TinyBlocks_TypeBlock* t = tb_rt_find_type(rt, type);
|
||||
if (!t) { printf(" (tipo %s nao existe)\n", type); return NULL; }
|
||||
last = tb_block_create(rt, t);
|
||||
const char* in[3] = { a, b, c };
|
||||
for (uint32_t i = 0; i < 3 && i < t->input_desc_count; i++) {
|
||||
if (!in[i]) continue;
|
||||
TinyBlocks_Value v;
|
||||
char* e;
|
||||
switch (t->input_descs[i].expected_kind) {
|
||||
case TB_VALUE_INTEGER: v = tb_value_integer(strtoll(in[i], NULL, 10)); break;
|
||||
case TB_VALUE_REAL: v = tb_value_real(strtod(in[i], NULL)); break;
|
||||
case TB_VALUE_NONE: {
|
||||
long long iv = strtoll(in[i], &e, 10);
|
||||
if (in[i][0] && !*e) { v = tb_value_integer(iv); break; }
|
||||
double dv = strtod(in[i], &e);
|
||||
v = (in[i][0] && !*e) ? tb_value_real(dv) : tb_value_text(in[i]);
|
||||
break;
|
||||
}
|
||||
default: v = tb_value_text(in[i]); break;
|
||||
}
|
||||
tb_block_set_default(last, i, v);
|
||||
tb_value_free(&v);
|
||||
}
|
||||
tb_block_eval(last, rt);
|
||||
return &last->outputs[0];
|
||||
}
|
||||
|
||||
static bool is_text(TinyBlocks_Value* v, const char* s) {
|
||||
return v && v->kind == TB_VALUE_TEXT && v->as.text && strcmp(v->as.text, s) == 0;
|
||||
}
|
||||
static bool is_int(TinyBlocks_Value* v, long long n) {
|
||||
return v && v->kind == TB_VALUE_INTEGER && v->as.integer == n;
|
||||
}
|
||||
static bool is_real(TinyBlocks_Value* v, double d) {
|
||||
return v && v->kind == TB_VALUE_REAL && fabs(v->as.real - d) < 1e-9;
|
||||
}
|
||||
/* Lista igual ao JSON esperado (ex.: "[1,2,\"a\"]") */
|
||||
static bool is_list(TinyBlocks_Value* v, const char* json) {
|
||||
if (!v || v->kind != TB_VALUE_JSON || !v->as.json) return false;
|
||||
char* s = tb_json_stringify(v->as.json);
|
||||
char* exp_s = NULL;
|
||||
TinyBlocks_JsonValue* e = tb_json_parse(json, NULL, 0);
|
||||
if (e) exp_s = tb_json_stringify(e);
|
||||
bool ok = s && exp_s && strcmp(s, exp_s) == 0;
|
||||
if (!ok) printf(" obtido %s, esperado %s\n", s ? s : "(null)", exp_s ? exp_s : json);
|
||||
free(s); free(exp_s);
|
||||
if (e) tb_json_release(e);
|
||||
return ok;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
tinyblocks_init(&rt, NULL);
|
||||
TinyBlocks_LibraryBlock* ls = tb_library_register(rt, tb_string_get_library());
|
||||
TinyBlocks_LibraryBlock* ln = tb_library_register(rt, tb_number_get_library());
|
||||
TinyBlocks_LibraryBlock* lv = tb_library_register(rt, tb_vector_get_library());
|
||||
CHECK(ls && ln && lv, "libraries string, number e vector registradas");
|
||||
CHECK(!strcmp(tb_library_category(ls)->name, "Texto") &&
|
||||
!strcmp(tb_library_category(ln)->name, "Números") &&
|
||||
!strcmp(tb_library_category(lv)->name, "Listas"), "categorias Texto / Números / Listas");
|
||||
|
||||
/* -- Texto -- */
|
||||
CHECK(is_text(run("String.Upper", "maçã", NULL, NULL), "MAÇÃ"), "maiúsculas com acento");
|
||||
CHECK(is_text(run("String.Lower", "ÁRVORE", NULL, NULL), "árvore"), "minúsculas com acento");
|
||||
CHECK(is_int(run("String.Length", "maçã", NULL, NULL), 4), "número de letras conta UTF-8 (maçã = 4)");
|
||||
CHECK(is_text(run("String.Letter", "maçã", "3", NULL), "ç"), "letra 3 de maçã = ç");
|
||||
CHECK(is_text(run("String.Sub", "TinyBlocks", "5", "10"), "Blocks"), "letras 5 a 10");
|
||||
CHECK(is_text(run("String.Sub", "abc", "2", "99"), "bc"), "trecho cortado no fim");
|
||||
CHECK(is_int(run("String.Find", "pão de açúcar", "açúcar", NULL), 8), "posição conta letras");
|
||||
CHECK(is_int(run("String.Find", "abc", "z", NULL), 0), "posição 0 quando não acha");
|
||||
CHECK(is_text(run("String.Replace", "banana", "a", "o"), "bonono"), "troca todas as ocorrências");
|
||||
CHECK(is_text(run("String.Trim", " olá \n", NULL, NULL), "olá"), "apara espaços");
|
||||
CHECK(is_text(run("String.Repeat", "ab", "3", NULL), "ababab"), "repete 3 vezes");
|
||||
CHECK(is_text(run("String.Reverse", "maçã", NULL, NULL), "ãçam"), "inverte por letra (UTF-8)");
|
||||
CHECK(is_list(run("String.Split", "a,,b", ",", NULL), "[\"a\",\"\",\"b\"]"), "divide mantendo item vazio");
|
||||
CHECK(is_list(run("String.Split", "ñá", "", NULL), "[\"ñ\",\"á\"]"), "separador vazio = uma letra por item");
|
||||
CHECK(is_int(run("String.Contains", "Maçã Verde", "maçã", NULL), 1), "contém ignora maiúsculas");
|
||||
CHECK(is_int(run("String.StartsWith", "foto.png", "foto", NULL), 1), "começa com");
|
||||
CHECK(is_int(run("String.EndsWith", "foto.png", ".jpg", NULL), 0), "não termina com .jpg");
|
||||
CHECK(is_int(run("String.IsNumber", " 3.5 ", NULL, NULL), 1) &&
|
||||
is_int(run("String.IsNumber", "3a", NULL, NULL), 0), "é número?");
|
||||
CHECK(is_int(run("String.IsEmpty", " ", NULL, NULL), 1), "só espaços está vazio");
|
||||
|
||||
/* -- Números -- */
|
||||
CHECK(is_real(run("Number.Div", "10", "4", NULL), 2.5), "10 ÷ 4 = 2.5");
|
||||
CHECK(is_int(run("Number.Div", "10", "2", NULL), 5), "resultado exato sai inteiro");
|
||||
CHECK(is_int(run("Number.Div", "1", "0", NULL), 0), "divisão por 0 dá 0");
|
||||
CHECK(is_int(run("Number.Pow", "2", "10", NULL), 1024), "2 elevado a 10");
|
||||
CHECK(is_int(run("Number.Sqrt", "16", NULL, NULL), 4), "raiz de 16");
|
||||
CHECK(is_int(run("Number.Round", "2.5", NULL, NULL), 3) &&
|
||||
is_int(run("Number.Floor", "-2.5", NULL, NULL), -3) &&
|
||||
is_int(run("Number.Ceil", "2.1", NULL, NULL), 3), "arredondamentos");
|
||||
CHECK(is_real(run("Number.RoundTo", "3.14159", "2", NULL), 3.14), "arredonda com 2 casas");
|
||||
CHECK(is_int(run("Number.Sin", "90", NULL, NULL), 1) &&
|
||||
is_int(run("Number.Sin", "180", NULL, NULL), 0) &&
|
||||
is_int(run("Number.Cos", "0", NULL, NULL), 1), "trigonometria em graus (sen 180 = 0)");
|
||||
CHECK(is_int(run("Number.Atan", "1", NULL, NULL), 45), "arco-tangente de 1 = 45");
|
||||
CHECK(is_int(run("Number.Log10", "1000", NULL, NULL), 3), "log de 1000");
|
||||
CHECK(is_real(run("Number.Pi", NULL, NULL, NULL), 3.14159265358979), "pi");
|
||||
TinyBlocks_Value* r = run("Number.Random", "5", "6", NULL);
|
||||
CHECK(r && r->kind == TB_VALUE_REAL && r->as.real >= 5 && r->as.real < 6, "aleatório real entre 5 e 6");
|
||||
CHECK(is_int(run("Number.Clamp", "150", "0", "100"), 100), "limite entre 0 e 100");
|
||||
CHECK(is_text(run("Number.Format", "3.14159", "2", NULL), "3.14"), "formata com 2 casas");
|
||||
CHECK(is_int(run("Number.IsEven", "4", NULL, NULL), 1) &&
|
||||
is_int(run("Number.IsEven", "7", NULL, NULL), 0), "é par?");
|
||||
CHECK(is_int(run("Number.IsPrime", "97", NULL, NULL), 1) &&
|
||||
is_int(run("Number.IsPrime", "91", NULL, NULL), 0) &&
|
||||
is_int(run("Number.IsPrime", "1", NULL, NULL), 0), "é primo?");
|
||||
CHECK(is_int(run("Number.IsInteger", "2.5", NULL, NULL), 0), "2.5 não é inteiro");
|
||||
|
||||
/* -- Listas -- */
|
||||
CHECK(is_list(run("List.Empty", NULL, NULL, NULL), "[]"), "lista vazia");
|
||||
CHECK(is_list(run("List.Of", "maçã", "2", NULL), "[\"maçã\",2]"), "lista com (campo vazio fica de fora)");
|
||||
CHECK(is_list(run("List.Range", "3", "1", NULL), "[3,2,1]"), "números de 3 até 1");
|
||||
CHECK(is_list(run("List.Add", "1, 2", "3", NULL), "[1,2,3]"), "texto 'a, b' vira lista; adiciona no fim");
|
||||
CHECK(is_list(run("List.Add", "[\"x\"]", "y", NULL), "[\"x\",\"y\"]"), "texto JSON vira lista");
|
||||
CHECK(is_list(run("List.Insert", "a, c", "b", "2"), "[\"a\",\"b\",\"c\"]"), "insere na posição 2");
|
||||
CHECK(is_list(run("List.Insert", "a", "z", "99"), "[\"a\",\"z\"]"), "posição além do fim insere no fim");
|
||||
CHECK(is_list(run("List.Remove", "a, b, c", "2", NULL), "[\"a\",\"c\"]"), "remove o item 2");
|
||||
CHECK(is_list(run("List.Replace", "a, b, c", "2", "B"), "[\"a\",\"B\",\"c\"]"), "troca o item 2");
|
||||
CHECK(is_text(run("List.Item", "maçã, banana", "2", NULL), "banana"), "item 2");
|
||||
CHECK(is_int(run("List.Item", "10, 20", "1", NULL), 10), "item numérico sai como número");
|
||||
CHECK(is_text(run("List.Item", "a", "5", NULL), ""), "item fora da faixa = vazio");
|
||||
CHECK(is_int(run("List.Length", "a, b, c", NULL, NULL), 3), "tamanho da lista");
|
||||
CHECK(is_int(run("List.IndexOf", "a, B, c", "b", NULL), 2), "posição ignora maiúsculas");
|
||||
CHECK(is_int(run("List.IndexOf", "1, 2.0, 3", "2", NULL), 2), "posição compara números pelo valor");
|
||||
CHECK(is_int(run("List.Contains", "maçã, uva", "uva", NULL), 1) &&
|
||||
is_int(run("List.Contains", "maçã, uva", "pera", NULL), 0), "contém o item?");
|
||||
CHECK(is_list(run("List.Slice", "1,2,3,4,5", "2", "4"), "[2,3,4]"), "itens 2 a 4");
|
||||
CHECK(is_list(run("List.Reverse", "1, 2, 3", NULL, NULL), "[3,2,1]"), "inverte a lista");
|
||||
CHECK(is_list(run("List.Sort", "banana, 10, Abacate, 2", NULL, NULL), "[2,10,\"Abacate\",\"banana\"]"),
|
||||
"ordena números antes de textos");
|
||||
CHECK(is_text(run("List.Join", "a, b, c", " - ", NULL), "a - b - c"), "junta com separador");
|
||||
CHECK(is_real(run("List.Sum", "1, 2.5, x", NULL, NULL), 3.5), "soma ignora itens não numéricos");
|
||||
|
||||
/* Encadeia: lista da pasta de Texto vira lista de Listas */
|
||||
{
|
||||
TinyBlocks_TypeBlock* ts = tb_rt_find_type(rt, "String.Split");
|
||||
TinyBlocks_TypeBlock* tl = tb_rt_find_type(rt, "List.Length");
|
||||
TinyBlocks_Block* bs = tb_block_create(rt, ts);
|
||||
TinyBlocks_Block* bl = tb_block_create(rt, tl);
|
||||
TinyBlocks_Value v = tb_value_text("x;y;z"), sep = tb_value_text(";");
|
||||
tb_block_set_default(bs, 0, v); tb_block_set_default(bs, 1, sep);
|
||||
tb_value_free(&v); tb_value_free(&sep);
|
||||
tb_block_connect(bl, 0, bs, 0);
|
||||
tb_block_eval(bl, rt);
|
||||
CHECK(bl->outputs[0].kind == TB_VALUE_INTEGER && bl->outputs[0].as.integer == 3,
|
||||
"divida (Texto) conectado em tamanho da lista (Listas)");
|
||||
tb_block_destroy(bl, rt);
|
||||
tb_block_destroy(bs, rt);
|
||||
}
|
||||
|
||||
if (last) tb_block_destroy(last, rt);
|
||||
tinyblocks_deinit(&rt);
|
||||
if (fails) printf("\n%d FALHA(S)\n", fails);
|
||||
else printf("\nTUDO OK\n");
|
||||
return fails != 0;
|
||||
}
|
||||
Reference in new issue
Block a user