added a test for term functions
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
#include "../source/term.h"
|
||||||
// #========================================================================#
|
// #========================================================================#
|
||||||
// | PreacherDHM:TART
|
// | PreacherDHM:TART
|
||||||
// |
|
// |
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
#include "../includes/tart.h"
|
#include "../includes/tart.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN64
|
// if windows is defined.
|
||||||
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
struct tart_vec2 term_current_size() {
|
struct tart_vec2 term_current_size() {
|
||||||
struct tart_vec2 ret;
|
struct tart_vec2 ret;
|
||||||
@@ -19,10 +20,3 @@ struct tart_vec2 term_current_size() {
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
|
||||||
struct tart_vec2 term_current_size() {
|
|
||||||
struct tart_vec2 ret = {50,50};
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ set( CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
set( SOURCES
|
set( SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
test_tart.cpp
|
test_tart.cpp
|
||||||
|
test_term.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} ${SOURCES} )
|
add_executable(${PROJECT_NAME} ${SOURCES} )
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#include "test_tart.h"
|
#include "test_tart.h"
|
||||||
|
#include "test_term.h"
|
||||||
#include <Pickler.h>
|
#include <Pickler.h>
|
||||||
int main (int argc, char *argv[]) {
|
int main (int argc, char *argv[]) {
|
||||||
INSTALLSHELF;
|
INSTALLSHELF;
|
||||||
tart_run(&__pickle_shelf__);
|
tart_run(&__pickle_shelf__);
|
||||||
|
term_run(&__pickle_shelf__);
|
||||||
return PICKLESHELF;
|
return PICKLESHELF;
|
||||||
}
|
}
|
||||||
|
|||||||
31
testing/test_term.cpp
Normal file
31
testing/test_term.cpp
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#include <Windows.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include "test_term.h"
|
||||||
|
void term_run(struct pickle_shelf* shelf) {
|
||||||
|
struct pickle_shelf __pickle_shelf__ = *shelf; //start
|
||||||
|
|
||||||
|
|
||||||
|
CREATEJAR(Test_Term);
|
||||||
|
|
||||||
|
PICKLE(Test_get_window_size) {
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
|
||||||
|
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
||||||
|
int columns = (unsigned int)(csbi.srWindow.Right - csbi.srWindow.Left + 1);
|
||||||
|
int rows = (unsigned int)(csbi.srWindow.Bottom - csbi.srWindow.Top + 1);
|
||||||
|
|
||||||
|
std::cout << "\n";
|
||||||
|
std::cout << term_current_size().x << "term_current_size()\n";
|
||||||
|
std::cout << columns << " columns\n";
|
||||||
|
|
||||||
|
if(term_current_size().x != columns)
|
||||||
|
ASSERT("current_size.x is not the same as columns", false);
|
||||||
|
if(term_current_size().y != rows)
|
||||||
|
ASSERT("current_size.y is not the same as rows", false);
|
||||||
|
ASSERT("GOOD", true);
|
||||||
|
}();
|
||||||
|
|
||||||
|
ADDPICKLE(Test_Term, Test_get_window_size);
|
||||||
|
PUTJARONSHELF(Test_Term);
|
||||||
|
*shelf = __pickle_shelf__; // end
|
||||||
|
}
|
||||||
7
testing/test_term.h
Normal file
7
testing/test_term.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef TEST_TERM_H
|
||||||
|
#define TEST_TERM_H
|
||||||
|
|
||||||
|
#include <tart.h>
|
||||||
|
#include <Pickler.h>
|
||||||
|
void term_run(struct pickle_shelf*);
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user