From: Joel Holdsworth Date: Sat, 25 Jan 2014 08:48:27 +0000 (+0000) Subject: Fixed AnalogSnapshotTest X-Git-Tag: pulseview-0.2.0~115 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=1c4a9ec1780cf0d0b0e1eaa63292201523e94672;p=pulseview.git Fixed AnalogSnapshotTest This fixes bug #286 --- diff --git a/test/data/analogsnapshot.cpp b/test/data/analogsnapshot.cpp index 97d7518d..200d262b 100644 --- a/test/data/analogsnapshot.cpp +++ b/test/data/analogsnapshot.cpp @@ -33,26 +33,18 @@ BOOST_AUTO_TEST_SUITE(AnalogSnapshotTest) void push_analog(AnalogSnapshot &s, unsigned int num_samples, float value) { - sr_datafeed_analog analog; - analog.num_samples = num_samples; + float *const data = new float[num_samples]; + for (unsigned int i = 0; i < num_samples; i++) + data[i] = value; - float *data = new float[num_samples]; - analog.data = data; - while(num_samples-- != 0) - *data++ = value; - - s.append_payload(analog); - delete[] (float*)analog.data; + s.append_interleaved_samples(data, num_samples, 1); + delete[] data; } BOOST_AUTO_TEST_CASE(Basic) { // Create an empty AnalogSnapshot object - sr_datafeed_analog analog; - analog.num_samples = 0; - analog.data = NULL; - - AnalogSnapshot s(analog); + AnalogSnapshot s; //----- Test AnalogSnapshot::push_analog -----//