Commit 646c4262 authored by Arnaud Blanchard's avatar Arnaud Blanchard
Browse files

Unitary tests to show simple blc_text functions

parent 2fc57d4b
cmake_minimum_required(VERSION 2.6)
find_package(blc_core REQUIRED)
#Add your properties with the ones of BL_... which have been set by find_package
add_executable(t_text main.c)
target_link_libraries(t_text ${BL_LIBRARIES})
#include "blc_core.h"
#define SIZE_TO_WRITE 1000456670 //Random value to display in a more human friendly format
int main(){
int rows_nb, columns_nb;
float values[3]={1.3, 4.2, 5.5};
//We use stderr as output each time it concerns information for the user but does not have to be interpreted or parsed by a program.
fprintf(stderr, "\n");
underline_fprintf('=', stderr, "Testing blc_text");
color_fprintf(BLC_BLUE, stderr, "\nWriting in blue\n\n");
underline_fprintf('-', stderr, "Writing underlining with '-'");
fprintf(stderr, "Writing 3 floats of an array as tsv format. It can be imported in excel or equivalent.\n");
fprint_tsv_floats(stderr, values, 3);
//Getting the size in characters of the current terminal
blc_terminal_get_size(&columns_nb, &rows_nb);
fprintf(stderr, "\nSize of the terminal %dx%d\n", columns_nb, rows_nb);
//Writing size in human readable format
fprintf(stderr, "%d can be written as:", SIZE_TO_WRITE);
fprint_human_size(stderr, SIZE_TO_WRITE); //1Kb = 1024b
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment