Teonet library  0.4.7
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
teonet_tst.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "ev_mgr.h"

Functions

void event_cb (ksnetEvMgrClass *ke, ksnetEvMgrEvents event, void *data, size_t data_len, void *user_data)
 Teonet event handler. More...
 
void test_2_1 ()
 
void test2 (int argc, char **argv)
 
int main (int argc, char **argv)
 

Detailed Description

Author
Kirill Scherba kiril.nosp@m.l@sc.nosp@m.herba.nosp@m..ru

Simple C Test Suite

Simple C test code:

#include <stdio.h>
#include <stdlib.h>
/*
* Simple C Test Suite
*/
#include "ev_mgr.h"
size_t data_len, void *user_data) {
switch(event) {
// Send immediately after event manager starts
printf("Event: Event manager started\n");
//host_started_cb(ke);
break;
// Send when new peer connected to this host (and to the mesh)
printf("Event: Peer '%s' was connected\n", ((ksnCorePacketData*)data)->from);
break;
printf("Event: Peer '%s' was disconnected\n", ((ksnCorePacketData*)data)->from);
break;
// Send when data received
printf("Event: Data received\n");
//host_received_cb(ke, data, data_len);
break;
// Send when idle (every 11.5 sec idle time)
case EV_K_IDLE:
printf("Event: Idle time\n");
//host_idle_cb(ke);
break;
// Undefined event (an error)
default:
break;
}
}
void test_2_1() {
printf("teonet test 1\n");
//printf("%%TEST_FAILED%% time=0 testname=test1 (teonet) message=error message sample\n");
}
void test2(int argc, char** argv) {
printf("teonet test 2\n");
printf("Teonet library ver " VERSION " connection test\n");
// Initialize teonet event manager and Read configuration (defaults,
// command line, configuration file)
// Hello message
"KSMesh UDP Client Server test ver. " VERSION "\n\n");
// Start teonet
}
int main(int argc, char** argv) {
printf("%%SUITE_STARTING%% teonet\n");
printf("%%SUITE_STARTED%%\n");
printf("%%TEST_STARTED%% test1 (teonet)\n");
printf("%%TEST_FINISHED%% time=0 test1 (teonet) \n");
printf("%%TEST_STARTED%% test2 (teonet)\n");
test2(argc, argv);
printf("%%TEST_FINISHED%% time=0 test2 (teonet) \n");
printf("%%SUITE_FINISHED%% time=0\n");
return (EXIT_SUCCESS);
}

Created on Jun 30, 2015, 10:31:15 AM

Function Documentation

void event_cb ( ksnetEvMgrClass ke,
ksnetEvMgrEvents  event,
void *  data,
size_t  data_len,
void *  user_data 
)

Teonet event handler.

Parameters
ke
event
data
data_len
user_data

References EV_K_CONNECTED, EV_K_DISCONNECTED, EV_K_IDLE, EV_K_RECEIVED, and EV_K_STARTED.

Referenced by test2().

int main ( int  argc,
char **  argv 
)

References test2(), and test_2_1().

void test2 ( int  argc,
char **  argv 
)
void test_2_1 ( )

Referenced by main().