X-Git-Url: https://sigrok.org/gitweb/?p=libsigrokdecode.git;a=blobdiff_plain;f=tests%2Fdecoder.c;h=3acabaeca30e2c7c30c910eec8ff0c61323596e1;hp=2b88785859e32a44f79c527feb71103d9dfe9756;hb=HEAD;hpb=1b6f39e39b9700a787db81268c4ae9cd0d3f1499 diff --git a/tests/decoder.c b/tests/decoder.c index 2b88785..3acabae 100644 --- a/tests/decoder.c +++ b/tests/decoder.c @@ -14,8 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ #include @@ -389,11 +388,14 @@ END_TEST START_TEST(test_doc_get) { struct srd_decoder *dec; + char *doc; srd_init(DECODERS_TESTDIR); srd_decoder_load("uart"); dec = srd_decoder_get_by_id("uart"); - fail_unless(srd_decoder_doc_get(dec) != NULL); + doc = srd_decoder_doc_get(dec); + fail_unless(doc != NULL); + g_free(doc); srd_exit(); } END_TEST @@ -402,11 +404,19 @@ END_TEST * Check whether srd_decoder_doc_get() fails with NULL as argument. * If it returns a value != NULL (or segfaults) this test will fail. * See also: http://sigrok.org/bugzilla/show_bug.cgi?id=179 + * Check whether srd_decoder_doc_get() fails with dec->py_mod == NULL. + * If it returns a value != NULL (or segfaults) this test will fail. + * See also: http://sigrok.org/bugzilla/show_bug.cgi?id=180 */ START_TEST(test_doc_get_null) { + struct srd_decoder dec; + + dec.py_mod = NULL; + srd_init(DECODERS_TESTDIR); fail_unless(srd_decoder_doc_get(NULL) == NULL); + fail_unless(srd_decoder_doc_get(&dec) == NULL); srd_exit(); } END_TEST