信号处理库,测试驱动开发 [英] Test driven development for signal processing libraries

查看:194
本文介绍了信号处理库,测试驱动开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和音频处理工作,一般用Matlab进行原型设计和C ++实施。最近,我一直在阅读了关于TDD。我已经看过了一些基本的例子,并感到很热心的范例。

I work with audio manipulation, generally using Matlab for prototyping, and C++ for implementation. Recently, I have been reading up on TDD. I have looked over a few basic examples and am quite enthusiastic about the paradigm.

目前,我用什么我会考虑一个全球性的测试辅助的方法。对于这一点,我在写C ++信号处理模块,然后让我可以用我的类接口的简单Matlab的MEX文件。随后,我添加功能,检查结果匹配与同等MATLAB脚本,我去。该工程确定,但测试很快成为过时的系统发展。 Furtermore,我测试整个系统,而不仅仅是单元。

At the moment, I use what I would consider a global 'test-assisted' approach. For this, I write signal processing blocks in C++, and then I make a simple Matlab mex file that can interface with my classes. I subsequently add functionality, checking that the results match up with an equivalent Matlab script as I go. This works ok, but the tests become obsolete quickly as the system evolves. Furtermore, I am testing the whole system, not just units.

这将是不错的使用建立的TDD框架,在那里我可以有一个测试套件,但我不知道怎样才能验证处理模块的功能,而他们也都同样为code作为复杂的测试测试下。我怎么会产生一个C ++测试基准信号以验证处理块没有被检验自我实现的预言的一种形式?

It would be nice to use an established TDD framework where I can have a test suite, but I don't see how I can validate the functionality of the processing blocks without tests that are equally as complex as the code under test. How would I generate the reference signals in a C++ test to validate a processing block without the test being a form of self-fulfilling prophecy?

如果任何人有这方面经验,还是可以提出一些方法,我可以读入,那么这将是巨大的。

If anyone has experience in this area, or can suggest some methodologies that I could read into, then that would be great.

推荐答案

我认为这是伟大应用TDD方式的信号处理(这将有救了我几个月的时间,如果我几年前就知道这件事时,我是在做信号处理自己)。我认为,关键是你的系统分解成可以独立测试的最低水平组件,例如:

I think it's great to apply the TDD approach to signal processing (it would have saved me months of time if I knew about it years ago when I was doing signal processing myself). I think the key is to break down your system into the lowest level components that can be independently tested, eg:


  • 的FFT:在已知的频率测试信号:DC,FS / NFFT,FS / 2和不同阶段等。检查峰和相位如您所愿,检查归一化常数是你期望

  • 峰位:测试你找到正确的最大值/最小值

  • 过滤器:如预期产生在已知的频率输入并检查输出幅值和相位

您不可能得到的究竟的相同的结果出来℃之间++和Matlab,所以你必须在某些测试中提供误差范围。 TDD是C你有,但尝试不同的实现时是非常有用的,不仅验证$ C $的正确性的好方法。例如,如果你想替换具有另一个FFT实现,常常是与数据被打包的方式,或者是,用于归一化常数略有不同。 TDD会给你一个高度的信心,新库被正确地整合。

You are unlikely to get exactly the same results out between C++ and Matlab, so you'll have to supply error bounds on some of the tests. TDD is a great way of not only verifying the correctness of the code you have but is really useful when trying out different implementations. For example if you want to replace one FFT implementation with another, there are often slight differences with the way the data is packed, or the normalisation constant that is used. TDD will give you a high degree of confidence the new library is correctly integrated.

这篇关于信号处理库,测试驱动开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆