Lolly
1.4.28
Loading...
Searching...
No Matches
tests
lolly
system
shared_lib_test.cpp
Go to the documentation of this file.
1
2
/******************************************************************************
3
* MODULE : shared_lib_test.cpp
4
* DESCRIPTION: tests on dynamic library loading
5
* COPYRIGHT : (C) 2024 jingkaimori
6
*******************************************************************************
7
* This software falls under the GNU general public license version 3 or later.
8
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10
******************************************************************************/
11
12
#include "
a_lolly_test.hpp
"
13
#include "
lolly/system/shared_lib.hpp
"
14
#include "
sys_utils.hpp
"
15
16
#ifndef OS_WASM
17
using
lolly::system::load_shared_library
;
18
using
lolly::system::shared_lib;
19
#endif
20
21
TEST_CASE
(
"load_shared_library"
) {
22
#ifndef OS_WASM
23
url
lib_path
;
24
if
(
os_win
()) {
25
lib_path
=
url_pwd
() *
"example_dynamic_library.dll"
;
26
}
27
else
if
(
os_macos
()) {
28
lib_path
=
url_pwd
() *
"libexample_dynamic_library.dylib"
;
29
}
30
else
{
31
lib_path
=
url_pwd
() *
"libexample_dynamic_library.so"
;
32
}
33
shared_lib
lib
= load_shared_library (
"example_dynamic_library"
,
lib_path
);
34
double (*func) (int)=
lib
->get_function<
double
,
int
> (
"square_div_2"
);
35
double
res
= func (5);
36
CHECK_EQ
(
res
, 12.5);
37
#endif
38
}
a_lolly_test.hpp
list
The list class represents a linked list.
Definition
list.hpp:48
url
Definition
url.hpp:37
lolly::system::load_shared_library
shared_lib load_shared_library(string name, url path)
Definition
shared_lib.cpp:28
TEST_CASE
TEST_CASE("test for operator+= and advance()")
Definition
parse_string_test.cpp:85
shared_lib.hpp
os_macos
bool os_macos()
Definition
sys_utils.cpp:112
os_win
bool os_win()
Definition
sys_utils.cpp:94
sys_utils.hpp
url_pwd
url url_pwd()
Definition
url.cpp:326
Generated by
1.10.0