From 56e800af4c3ae74b0790767e760c05a83b8f59a2 Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Mon, 26 Aug 2019 22:51:30 +0200 Subject: [PATCH] Added simple test file --- Makefile | 15 +++++++++++---- test/main.cpp | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 test/main.cpp diff --git a/Makefile b/Makefile index 6876196..fa4e2e8 100644 --- a/Makefile +++ b/Makefile @@ -15,10 +15,13 @@ USRSCTP_CFLAGS:=-fPIC -Wno-address-of-packed-member SRCS=$(shell printf "%s " src/*.cpp) OBJS=$(subst .cpp,.o,$(SRCS)) -all: $(NAME).a $(NAME).so +all: $(NAME).a $(NAME).so tests -%.o: %.cpp - $(CXX) $(INCLUDES) $(CPPFLAGS) $(USRSCTP_DEFINES) -MMD -MP -o $@ -c $< +src/%.o: src/%.cpp + $(CXX) $(CPPFLAGS) $(INCLUDES) $(USRSCTP_DEFINES) -MMD -MP -o $@ -c $< + +test/%.o: test/%.cpp + $(CXX) $(CPPFLAGS) -Isrc -MMD -MP -o $@ -c $< -include $(subst .o,.d,$(OBJS)) @@ -26,7 +29,10 @@ $(NAME).a: $(OBJS) $(AR) crf $@ $(OBJS) $(NAME).so: libusrsctp.a $(OBJS) - $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) -shared libusrsctp.a + $(CXX) $(LDFLAGS) -shared -o $@ $(OBJS) $(LDLIBS) libusrsctp.a + +tests: $(NAME).a test/main.o + $(CXX) $(LDFLAGS) -o $@ test/main.o $(LDLIBS) $(NAME).a libusrsctp.a clean: $(RM) src/*.o src/*.d @@ -40,3 +46,4 @@ dist-clean: clean libusrsctp.a: cd $(USRSCTP_DIR) && ./bootstrap && CFLAGS="$(USRSCTP_CFLAGS)" ./configure --enable-static && make cp $(USRSCTP_DIR)/usrsctplib/.libs/libusrsctp.a . + diff --git a/test/main.cpp b/test/main.cpp new file mode 100644 index 0000000..f1abc99 --- /dev/null +++ b/test/main.cpp @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2019 Paul-Louis Ageneau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include + +using namespace rtc; +using namespace std; + +int main(int argc, char **argv) { + IceConfiguration config; + + auto pc = std::make_unique(config); + + pc->onLocalDescription([](const string &sdp) { + cout << sdp << endl; + }); + + pc->createDataChannel("test"); +} +