version 4.0.0 first support for new E2 ASN
[ric-plt/e2.git] / RIC-E2-TERMINATION / TEST / testAsn / sctpClient / sctpClientTest.cpp
1 /*
2  * Copyright 2020 AT&T Intellectual Property
3  * Copyright 2020 Nokia
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 //
19 // Created by adi ENZEL on 2/10/20.
20 //
21 #include <thread>
22 #include <vector>
23 #include <cgreen/cgreen.h>
24
25 //#include "sctpClient.cpp"
26
27 int epoll_fd = 0;
28
29 Describe(Cgreen);
30 BeforeEach(Cgreen) {}
31 AfterEach(Cgreen) {
32     close(epoll_fd);
33 }
34
35 using namespace cgreen;
36 using namespace std;
37
38
39 Ensure(Cgreen, createEpoll) {
40     epoll_fd = createEpoll();
41     assert_that(epoll_fd != -1);
42     assert_that(epoll_fd > 0);
43 }
44
45
46
47 Ensure(Cgreen, createConnectionIpV6) {
48     auto epoll_fd = createEpoll();
49     assert_that(epoll_fd != -1);
50     assert_that(epoll_fd > 0);
51     unsigned num_cpus = std::thread::hardware_concurrency();
52     std::vector<std::thread> threads(num_cpus);
53 //    int i = 0;
54
55 //    threads[i] = std::thread(listener, &epoll_fd);
56 //    auto port = 36422;
57 //    auto fd = createSctpConnction("::1", port, epoll_fd);
58 //    assert_that(fd != -1);
59 //    assert_that(fd == 0);
60 //    threads[i].join();
61 //
62 //    close(fd);
63 }
64
65 Ensure(Cgreen, createConnectionIpV4) {
66     auto epoll_fd = createEpoll();
67     assert_that(epoll_fd != -1);
68     assert_that(epoll_fd > 0);
69     unsigned num_cpus = std::thread::hardware_concurrency();
70     std::vector<std::thread> threads(num_cpus);
71 //    int i = 0;
72
73 //    threads[i] = std::thread(listener, &epoll_fd);
74 //    auto port = 36422;
75 //    auto fd = createSctpConnction("127.0.0.1", port, epoll_fd);
76 //    assert_that(fd != -1);
77 //    assert_that(fd == 0);
78 //
79 //    threads[i].join();
80 //    close(fd);
81 }
82
83
84 //int main(const int argc, char **argv) {
85 //    TestSuite *suite = create_named_test_suite_(__FUNCTION__, __FILE__, __LINE__);
86 //
87 //    add_test_with_context(suite, Cgreen, createEpoll);
88 //    //add_test_with_context(suite, Cgreen, createConnectionIpV6);
89 //    add_test_with_context(suite, Cgreen, createConnectionIpV4);
90 //    return cgreen::run_test_suite(suite, create_text_reporter());
91 //}