adding tests + updating build
This commit is contained in:
parent
413f741ac8
commit
2ba214819e
2 changed files with 39 additions and 2 deletions
|
|
@ -39,13 +39,14 @@ endif()
|
|||
|
||||
option( UNITY_BUILD OFF )
|
||||
|
||||
include_directories( ~/projects/mace/libs/atomic/include )
|
||||
include_directories( ~/projects/mace/libs/context/include )
|
||||
include_directories( vendor/boost/process/include )
|
||||
include_directories( ${Boost_INCLUDE_DIR} )
|
||||
include_directories( include )
|
||||
|
||||
set( sources
|
||||
src/process.cpp
|
||||
src/http_connection.cpp
|
||||
src/json_rpc_connection.cpp
|
||||
src/value.cpp
|
||||
src/lexical_cast.cpp
|
||||
src/spin_lock.cpp
|
||||
|
|
@ -81,6 +82,8 @@ set( sources
|
|||
)
|
||||
setup_library( fc SOURCES ${sources} )
|
||||
|
||||
setup_executable( json_rpc_test SOURCES tests/json_rpc_test.cpp LIBRARIES fc ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_CHRONO_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} )
|
||||
|
||||
#add_executable( test_vec tests/vector_test.cpp )
|
||||
#target_link_libraries( test_vec fc ${Boost_SYSTEM_LIBRARY} ${Boost_CHRONO_LIBRARY} ${Boost_THREAD_LIBRARY} ${Boost_CONTEXT_LIBRARY} )
|
||||
|
||||
|
|
|
|||
34
tests/json_rpc_test.cpp
Normal file
34
tests/json_rpc_test.cpp
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include <fc/json_rpc_client.hpp>
|
||||
#include <iostream>
|
||||
|
||||
struct test {
|
||||
int add(int x){ return x+1; }
|
||||
int sub(int x){ return x-1; }
|
||||
int sub1(int x){ return 3; }
|
||||
int sub2(float x){ return 3; }
|
||||
int sub3(double x){ return 3; }
|
||||
int sub4(uint16_t x){ return 3; }
|
||||
int sub5(char x){ return 3; }
|
||||
int sub6(uint64_t x){ return 3; }
|
||||
int sub7(int x){ return 3; }
|
||||
int sub8(int x){ return 3; }
|
||||
int sub9(int x){ return 3; }
|
||||
};
|
||||
|
||||
FC_STUB( test, (add)(sub)(sub1)(sub2)(sub3)(sub4)(sub5)(sub6)(sub7)(sub8)(sub9) )
|
||||
|
||||
int main( int argc, char** argv ) {
|
||||
try {
|
||||
fc::json::rpc_connection con(fc::cin,fc::cout);
|
||||
fc::json::rpc_client<test> c( con );
|
||||
|
||||
slog( "%d", c->add( 5 ).wait() );
|
||||
slog( "%d", c->add( 6 ).wait() );
|
||||
|
||||
slog( "Exiting" );
|
||||
} catch ( ... ) {
|
||||
elog( "%s", fc::except_str().c_str() );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in a new issue