X-Git-Url: http://developer.intra2net.com/git/?a=blobdiff_plain;f=test%2Fbaudrate.cpp;h=29bbd209835f7f92424f8bd974fe7dbe75bec0a6;hb=17eb1c4e036dc787ef18b0a80ca93fc2c3f27fbf;hp=8bd04ebfbdefb04543e48201d188059917a95f5b;hpb=0d119163cc334fcc4063e85f39c964c6ed4a3679;p=libftdi diff --git a/test/baudrate.cpp b/test/baudrate.cpp index 8bd04eb..29bbd20 100644 --- a/test/baudrate.cpp +++ b/test/baudrate.cpp @@ -1,7 +1,7 @@ /**@file @brief Test baudrate calculator code -@author Thomas Jarosch +@author Thomas Jarosch and Uwe Bonnes */ /*************************************************************************** @@ -39,7 +39,7 @@ public: ftdi = ftdi_new(); } - ~BaseFTDIFixture() + virtual ~BaseFTDIFixture() { delete ftdi; ftdi = NULL; @@ -106,6 +106,7 @@ static void test_baudrates(ftdi_context *ftdi, const map &baud break; default:; } + // Aid debugging since this test is a generic function BOOST_CHECK_MESSAGE(res->actual_baudrate == calc_baudrate && res->divisor == divisor && res->fractional_bits == fractional_bits && res->clock == clock, @@ -123,7 +124,7 @@ BOOST_AUTO_TEST_CASE(TypeAMFixedBaudrates) ftdi->type = TYPE_AM; map baudrates; - baudrates[183] = calc_result(183, 16383, 3, 48); + baudrates[183] = calc_result(183, 16383, 0, 48); baudrates[300] = calc_result(300, 10000, 0, 48); baudrates[600] = calc_result(600, 5000, 0, 48); baudrates[1200] = calc_result(1200, 2500, 0, 48); @@ -140,12 +141,12 @@ BOOST_AUTO_TEST_CASE(TypeAMFixedBaudrates) baudrates[1000000] = calc_result(1000000, 3, 0, 48); baudrates[1090512] = calc_result(1000000, 3, 0, 48); baudrates[1090909] = calc_result(1000000, 3, 0, 48); - baudrates[1090910] = calc_result(1200000, 2, 1, 48); + baudrates[1090910] = calc_result(1000000, 3, 0, 48); baudrates[1200000] = calc_result(1200000, 2, 1, 48); baudrates[1333333] = calc_result(1333333, 2, 2, 48); baudrates[1411764] = calc_result(1411765, 2, 3, 48); baudrates[1500000] = calc_result(1500000, 2, 0, 48); - baudrates[2000000] = calc_result(2000000, 1, 0, 48); + baudrates[2000000] = calc_result(1500000, 2, 0, 48); baudrates[3000000] = calc_result(3000000, 0, 0, 48); test_baudrates(ftdi, baudrates); @@ -199,6 +200,7 @@ BOOST_AUTO_TEST_CASE(TypeBMFixedBaudrates) baudrates[(3000000*16/(2*16+ 3))+1] = calc_result(round(3000000/2.125), 2, 3, 48); baudrates[ 3000000*16/(2*16+ 1) ] = calc_result(round(3000000/2.125), 2, 3, 48); baudrates[(3000000*16/(2*16+ 1))+1] = calc_result(round(3000000/2.000), 2, 0, 48); + BOOST_FOREACH(const enum ftdi_chip_type &test_chip_type, test_types) { ftdi->type = test_chip_type;