/* * doi_test.c * * Copyright (c) 2016-2018 * * Source code released under the GPL version 2 * */ #include #include #include "url.h" char progname[] = "doi_test"; typedef struct test_t { char *s; int expected; } test_t; int test_is_doi( void ) { test_t tests[] = { { "10.1021/", 0 }, { "00.0000/", 0 }, { "00,0000/", -1 }, { "doi:99.9999/", 4 }, { "doi: 99.9999/", 5 }, { "doi: DOI: 99.9999/", 10 }, { "http://www.test.com", -1 }, }; int ntests = sizeof( tests ) / sizeof( tests[0] ); int failed = 0; int found; int i; for ( i=0; i