CSL 5.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Classes | Macros | Functions | Variables
testlo.c File Reference
`#include <math.h>`
`#include <float.h>`
`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <unistd.h>`
`#include "lo_types_internal.h"`
`#include "lo_internal.h"`
`#include "lo/lo.h"`
`#include "config.h"`

Go to the source code of this file.

## Classes
union | end_test32
union | end_test64

## Macros
#define | PATHDELIM "/"
#define | MSG_NOSIGNAL 0
#define | TEST(cond)
#define | JITTER_ITS 25

## Functions
void | exitcheck (void)
void | test_deserialise (void)
void | test_validation (lo_address a)
void | test_multicast (lo_server_thread st)
void | error (int num, const char *m, const char *path)
void | rep_error (int num, const char *m, const char *path)
int | generic_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | foo_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | reply_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | lots_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | coerce_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | bundle_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | timestamp_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | jitter_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | pattern_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | subtest_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | subtest_reply_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | quit_handler (const char *path, const char *types, lo_arg **argv, int argc, lo_message data, void *user_data)
int | test_varargs (lo_address a, const char *path, const char *types,...)
int | main ()
void | replace_char (char *str, size_t size, const char find, const char replace)

## Variables
static int | done = 0
static int | bundle_count = 0
static int | pattern_count = 0
static int | reply_count = 0
static int | subtest_count = 0
static int | subtest_reply_count = 0
static int | error_okay = 0
char | testdata [5] = "ABCDE"
static int | jitter_count = 0
static float | jitter_total = 0.0f
static float | jitter_max = 0.0f
static float | jitter_min = 1000.0f

## Macro Definition Documentation

#define PATHDELIM "/"

Definition at line 42 of file testlo.c.

Referenced by main().

#define MSG_NOSIGNAL 0

Definition at line 46 of file testlo.c.

Referenced by test_validation().

#define TEST | ( |  | cond | ) |

Value:
if (!(cond)) { fprintf(stderr, "FAILED " #cond \
" at %s:%d\n", __FILE__, __LINE__); \
exit(1); } \
else { printf("passed " #cond "\n"); }

Definition at line 49 of file testlo.c.

Referenced by coerce_handler(), lots_handler(), main(), test_deserialise(), test_multicast(), and timestamp_handler().

#define JITTER_ITS 25

Referenced by main().

## Function Documentation

void exitcheck | ( | void |  | ) |

Definition at line 723 of file testlo.c.

References done, and PACKAGE_NAME.

Referenced by main().

void test_deserialise | ( | void |  | ) |

Definition at line 961 of file testlo.c.

References end_test64::c, lo_timetag::frac, lo_blob_dataptr(), lo_blob_datasize(), lo_blob_free(), lo_blob_new(), lo_blobsize(), LO_EBADTYPE, LO_EINVALIDARG, LO_EINVALIDPATH, LO_EINVALIDTYPE, LO_ENOTYPE, LO_ESIZE, lo_get_path(), lo_htoo32, lo_message_add_blob(), lo_message_add_char(), lo_message_add_double(), lo_message_add_false(), lo_message_add_float(), lo_message_add_infinitum(), lo_message_add_int32(), lo_message_add_int64(), lo_message_add_midi(), lo_message_add_nil(), lo_message_add_string(), lo_message_add_symbol(), lo_message_add_timetag(), lo_message_add_true(), lo_message_deserialise(), lo_message_free(), lo_message_get_argc(), lo_message_get_argv(), lo_message_get_types(), lo_message_length(), lo_message_new(), lo_message_serialise(), replace_char(), lo_arg::t, TEST, and testdata.

Referenced by main().

void test_validation | ( | lo_address | a | ) |

Definition at line 1136 of file testlo.c.

References error_okay, lo_client_sockets, MSG_NOSIGNAL, and lo_cs::udp.

Referenced by main().

void test_multicast | ( | lo_server_thread | st | ) |

Definition at line 1174 of file testlo.c.

References error(), foo_handler(), lo_address_errno(), lo_address_errstr(), lo_address_free(), lo_address_new(), lo_address_set_ttl(), lo_send_from(), lo_server_add_method(), lo_server_free(), lo_server_new_multicast(), lo_server_recv(), lo_server_thread_get_server(), LO_TT_IMMEDIATE, reply_handler(), and TEST.

Referenced by main().

void error | ( | int | num,
|  | const char * | m,
|  | const char * | path
| ) |  |

void rep_error | ( | int | num,
|  | const char * | m,
|  | const char * | path
| ) |  |

Definition at line 742 of file testlo.c.

References error().

Referenced by main().

int generic_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

int foo_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

int reply_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 786 of file testlo.c.

References lo_address_get_url(), lo_message_get_source(), and reply_count.

Referenced by main(), and test_multicast().

int lots_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 798 of file testlo.c.

References end_test64::c, lo_timetag::frac, lo_blob_dataptr(), lo_blob_datasize(), lo_arg::m, lo_arg::t, and TEST.

Referenced by main().

int coerce_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 837 of file testlo.c.

References TEST.

Referenced by main().

int bundle_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 852 of file testlo.c.

References bundle_count.

Referenced by main().

int timestamp_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 861 of file testlo.c.

References lo_timetag::frac, lo_arg::i, lo_message_get_timestamp(), LO_TT_IMMEDIATE, lo_timetag::sec, lo_arg::t, and TEST.

Referenced by main().

int jitter_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 879 of file testlo.c.

References lo_timetag::frac, jitter_count, jitter_max, jitter_min, jitter_total, lo_timetag_diff(), lo_timetag_now(), lo_timetag::sec, and lo_arg::t.

Referenced by main().

int pattern_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 898 of file testlo.c.

References pattern_count.

Referenced by main().

int subtest_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

int subtest_reply_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

Definition at line 920 of file testlo.c.

References subtest_reply_count.

Referenced by main().

int quit_handler | ( | const char * | path,
|  | const char * | types,
|  | lo_arg ** | argv,
|  | int | argc,
|  | lo_message | data,
|  | void * | user_data
| ) |  |

int test_varargs | ( | lo_address | a,
|  | const char * | path,
|  | const char * | types,
|  |  | ...
| ) |  |

Definition at line 937 of file testlo.c.

References error(), lo_message_add_varargs(), lo_message_free(), lo_message_new(), and lo_send_message().

Referenced by main().

int main | ( |  | ) |

Definition at line 124 of file testlo.c.

References bundle_count, bundle_handler(), end_test32::c, end_test64::c, coerce_handler(), done, error(), exitcheck(), foo_handler(), lo_timetag::frac, generic_handler(), end_test32::i, end_test64::i, jitter_count, jitter_handler(), JITTER_ITS, jitter_max, jitter_min, jitter_total, lo_address_errno(), lo_address_errstr(), lo_address_free(), lo_address_get_hostname(), lo_address_get_port(), lo_address_get_protocol(), lo_address_get_url(), lo_address_new_from_url(), lo_address_new_with_proto(), lo_arg_pp(), LO_ARGS_END, LO_BLOB, lo_blob_datasize(), lo_blob_free(), lo_blob_new(), lo_blobsize(), lo_bundle_add_message(), lo_bundle_free(), lo_bundle_free_messages(), lo_bundle_new(), lo_htoo32, lo_htoo64, lo_message_add(), lo_message_add_int32(), lo_message_add_string(), lo_message_free(), lo_message_new(), lo_send(), lo_send_bundle(), lo_send_message(), lo_send_timestamped(), lo_server_add_method(), lo_server_del_method(), lo_server_free(), lo_server_get_protocol(), lo_server_get_url(), lo_server_new(), lo_server_new_with_proto(), lo_server_recv(), lo_server_recv_noblock(), lo_server_thread_add_method(), lo_server_thread_del_method(), lo_server_thread_events_pending(), lo_server_thread_free(), lo_server_thread_get_server(), lo_server_thread_get_url(), lo_server_thread_new(), lo_server_thread_start(), lo_server_thread_stop(), LO_TCP, lo_timetag_now(), LO_UDP, LO_UNIX, lo_url_get_hostname(), lo_url_get_path(), lo_url_get_port(), lo_url_get_protocol(), lo_url_get_protocol_id(), lots_handler(), PATHDELIM, pattern_count, pattern_handler(), quit_handler(), rep_error(), reply_count, reply_handler(), lo_timetag::sec, subtest_count, subtest_handler(), subtest_reply_count, subtest_reply_handler(), TEST, test_deserialise(), test_multicast(), test_validation(), test_varargs(), testdata, and timestamp_handler().

void replace_char | ( | char * | str,
|  | size_t | size,
|  | const char | find,
|  | const char | replace
| ) |  |

Definition at line 951 of file testlo.c.

Referenced by test_deserialise().

## Variable Documentation

int done = 0
| static

Definition at line 64 of file testlo.c.

int bundle_count = 0
| static

Definition at line 65 of file testlo.c.

Referenced by bundle_handler(), and main().

int pattern_count = 0
| static

Definition at line 66 of file testlo.c.

Referenced by main(), and pattern_handler().

int reply_count = 0
| static

Definition at line 67 of file testlo.c.

Referenced by main(), and reply_handler().

int subtest_count = 0
| static

Definition at line 68 of file testlo.c.

Referenced by main().

int subtest_reply_count = 0
| static

Definition at line 69 of file testlo.c.

Referenced by main(), and subtest_reply_handler().

int error_okay = 0
| static

Definition at line 70 of file testlo.c.

Referenced by test_validation().

char testdata[5] = "ABCDE"

Definition at line 72 of file testlo.c.

int jitter_count = 0
| static

Definition at line 74 of file testlo.c.

Referenced by jitter_handler(), and main().

float jitter_total = 0.0f
| static

Definition at line 75 of file testlo.c.

Referenced by jitter_handler(), and main().

float jitter_max = 0.0f
| static

Definition at line 76 of file testlo.c.

Referenced by jitter_handler(), and main().

float jitter_min = 1000.0f
| static

Definition at line 77 of file testlo.c.

Referenced by jitter_handler(), and main().