X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=blobdiff_plain;f=tests%2Flib.c;h=cdaff77126fb2dcc672d2833ffe8b63a65a62bf0;hp=acdca674c49f079da546b8da7f50baf8a0613552;hb=95bc7725949836f8fb9851a51fcc755b25e4fc6f;hpb=129d5bc961fb3589a08b391092d9a7e5eef522f6 diff --git a/tests/lib.c b/tests/lib.c index acdca674..cdaff771 100644 --- a/tests/lib.c +++ b/tests/lib.c @@ -63,25 +63,6 @@ struct sr_dev_driver *srtest_driver_get(const char *drivername) return driver; } -/* Get a libsigrok input format by ID. */ -struct sr_input_format *srtest_input_get(const char *id) -{ - struct sr_input_format **inputs, *input = NULL; - int i; - - inputs = sr_input_list(); - fail_unless(inputs != NULL, "No input modules found."); - - for (i = 0; inputs[i]; i++) { - if (strcmp(inputs[i]->id, id)) - continue; - input = inputs[i]; - } - fail_unless(input != NULL, "Input module '%s' not found.", id); - - return input; -} - /* Initialize a libsigrok driver. */ void srtest_driver_init(struct sr_context *sr_ctx, struct sr_dev_driver *driver) { @@ -109,40 +90,6 @@ void srtest_driver_init_all(struct sr_context *sr_ctx) } } -/* Initialize a libsigrok input module. */ -void srtest_input_init(struct sr_context *sr_ctx, struct sr_input_format *input) -{ - int ret; - struct sr_input *in; - - (void)sr_ctx; - - in = g_try_malloc0(sizeof(struct sr_input)); - fail_unless(in != NULL); - - in->format = input; - in->param = NULL; - - ret = in->format->init(in, "nonexisting.dat"); - fail_unless(ret == SR_OK, "Failed to init '%s' input module: %d.", - input->id, ret); - - g_free(in); -} - -/* Initialize all libsigrok input modules. */ -void srtest_input_init_all(struct sr_context *sr_ctx) -{ - struct sr_input_format **inputs; - int i; - - inputs = sr_input_list(); - fail_unless(inputs != NULL, "No input modules found."); - - for (i = 0; inputs[i]; i++) - srtest_input_init(sr_ctx, inputs[i]); -} - /* Set the samplerate for the respective driver to the specified value. */ void srtest_set_samplerate(struct sr_dev_driver *driver, uint64_t samplerate) { @@ -195,21 +142,6 @@ void srtest_check_samplerate(struct sr_context *sr_ctx, const char *drivername, drivername, s); } -void srtest_buf_to_file(const char *filename, const uint8_t *buf, uint64_t len) -{ - FILE *f; - GError *error = NULL; - gboolean ret; - - f = g_fopen(filename, "wb"); - fail_unless(f != NULL); - - ret = g_file_set_contents(filename, (const gchar *)buf, len, &error); - fail_unless(ret == TRUE); - - fclose(f); -} - GArray *srtest_get_enabled_logic_channels(const struct sr_dev_inst *sdi) { struct sr_channel *ch;