adding a small test
authorVolker Birk <vb@pep.foundation>
Thu, 04 Oct 2018 18:05:51 +0200
changeset 19913dbffb1746
parent 18 3fd21a5f82b2
child 20 a37d30b60a38
adding a small test
.hgignore
Makefile
Makefile.conf
test_adapter.cc
     1.1 --- a/.hgignore	Thu Oct 04 17:52:01 2018 +0200
     1.2 +++ b/.hgignore	Thu Oct 04 18:05:51 2018 +0200
     1.3 @@ -3,3 +3,4 @@
     1.4  *.a
     1.5  *.swp
     1.6  ws
     1.7 +test_adapter
     2.1 --- a/Makefile	Thu Oct 04 17:52:01 2018 +0200
     2.2 +++ b/Makefile	Thu Oct 04 18:05:51 2018 +0200
     2.3 @@ -3,12 +3,10 @@
     2.4  include Makefile.conf
     2.5  -include local.conf
     2.6  
     2.7 -TARGET?=libpEpAdapter.a
     2.8 -PEPENGINE_IN?=$(HOME)
     2.9 -
    2.10  CXXFLAGS += -I$(HOME)/include -std=c++14 -O0 -g
    2.11  
    2.12  SOURCE=$(wildcard *.cc)
    2.13 +HEADERS=$(wildcard *.hh)
    2.14  OBJECTS=$(subst .cc,.o,$(SOURCE))
    2.15  WITHOUT_TESTS=$(patsubst test%.o,,$(OBJECTS))
    2.16  
    2.17 @@ -20,7 +18,7 @@
    2.18  $(TARGET): $(WITHOUT_TESTS)
    2.19  	ar -rc $@ $^
    2.20  
    2.21 -.PHONY: clean test
    2.22 +.PHONY: clean test install
    2.23  
    2.24  clean:
    2.25  	rm -f $(TARGET) $(OBJECTS) *.a test_adapter
    2.26 @@ -29,5 +27,9 @@
    2.27  	./test_adapter
    2.28  
    2.29  test_adapter: test_adapter.o $(TARGET)
    2.30 -	$(CXX) -o $@ -L$(HOME)/lib -lpEpEngine -L. -lpEpAdapter $<
    2.31 +	$(CXX) -o $@ -L$(PEP)/lib -lpEpEngine -L. -lpEpAdapter $<
    2.32  
    2.33 +install:
    2.34 +	-mkdir -p $(PEP)/include
    2.35 +	cp $(HEADERS) $(PEP)/include
    2.36 +
     3.1 --- a/Makefile.conf	Thu Oct 04 17:52:01 2018 +0200
     3.2 +++ b/Makefile.conf	Thu Oct 04 18:05:51 2018 +0200
     3.3 @@ -1,2 +1,4 @@
     3.4 -# TARGET=libpEpAdapter.a
     3.5 -# PEPENGINE_IN=$(HOME)
     3.6 +TARGET=libpEpAdapter.a
     3.7 +PREFIX=$(HOME)
     3.8 +PEP=$(HOME)
     3.9 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/test_adapter.cc	Thu Oct 04 18:05:51 2018 +0200
     4.3 @@ -0,0 +1,29 @@
     4.4 +#include "Adapter.hh"
     4.5 +#include <iostream>
     4.6 +#include <assert.h>
     4.7 +#include <unistd.h>
     4.8 +
     4.9 +using namespace pEp;
    4.10 +using namespace std;
    4.11 +
    4.12 +PEP_STATUS messageToSend(struct _message *msg)
    4.13 +{
    4.14 +    cout << "calling messageToSend();\n";   
    4.15 +    return PEP_STATUS_OK;
    4.16 +}
    4.17 +
    4.18 +PEP_STATUS notifyHandshake(void *obj, pEp_identity *me, pEp_identity *partner, sync_handshake_signal signal)
    4.19 +{
    4.20 +    cout << "calling notifyHandshake();\n";   
    4.21 +    return PEP_STATUS_OK;
    4.22 +}
    4.23 +
    4.24 +int main()
    4.25 +{
    4.26 +    Adapter(messageToSend, notifyHandshake);
    4.27 +    sleep(3);
    4.28 +    Adapter::shutdown();
    4.29 +
    4.30 +    return 0;
    4.31 +}
    4.32 +