Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
blaar
blibs
blc_core
Commits
646c4262
Commit
646c4262
authored
Feb 05, 2017
by
Arnaud Blanchard
Browse files
Unitary tests to show simple blc_text functions
parent
2fc57d4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
t_text/CMakeLists.txt
0 → 100644
View file @
646c4262
cmake_minimum_required
(
VERSION 2.6
)
project
(
t_text
)
find_package
(
blc_core REQUIRED
)
#Add your properties with the ones of BL_... which have been set by find_package
add_definitions
(
${
BL_DEFINITIONS
}
)
include_directories
(
${
BL_INCLUDE_DIRS
}
)
add_executable
(
t_text main.c
)
target_link_libraries
(
t_text
${
BL_LIBRARIES
}
)
t_text/main.c
0 → 100644
View file @
646c4262
#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
,
"
\n
Writing 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
,
"
\n
Size 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
printf
(
"
\n
"
);
return
EXIT_SUCCESS
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment