X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=tests%2Fanalog.c;h=98d55b1cc6f3958cb6c1f039efef3186d2693a8b;hb=914f8160e7cacfafd89c372e7fbb8a3e515c141b;hp=6dd8299969e4e7425ef2e1d1cb3fcfde1a339078;hpb=962172e4950f3fbc42d5a79cdf63dc179d7513be;p=libsigrok.git diff --git a/tests/analog.c b/tests/analog.c index 6dd82999..98d55b1c 100644 --- a/tests/analog.c +++ b/tests/analog.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 @@ -198,13 +197,15 @@ START_TEST(test_analog_unit_to_string) struct sr_analog_encoding encoding; struct sr_analog_meaning meaning; struct sr_analog_spec spec; - const char *r[] = {" V RMS"}; + const int u[] = {SR_UNIT_VOLT, SR_UNIT_AMPERE, SR_UNIT_CELSIUS}; + const int f[] = {SR_MQFLAG_RMS, 0, 0}; + const char *r[] = {"V RMS", "A", "°C"}; sr_analog_init_(&analog, &encoding, &meaning, &spec, 3); - for (i = -1; i < ARRAY_SIZE(r); i++) { - meaning.unit = SR_UNIT_VOLT; - meaning.mqflags = SR_MQFLAG_RMS; + for (i = 0; i < ARRAY_SIZE(r); i++) { + meaning.unit = u[i]; + meaning.mqflags = f[i]; ret = sr_analog_unit_to_string(&analog, &result); fail_unless(ret == SR_OK); fail_unless(result != NULL);