参考单元测试常见的数据结构? [英] Reference unit tests for common data structures?

查看:142
本文介绍了参考单元测试常见的数据结构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个包含常见的数据结构的几个专门实施一个类库(列表,集,字典...)。我发现自己总在写同一单元测试一遍又一遍,我从来不相信我不会忘记测试一些重要的场景。

I'm writing a class library that contains several specialized implementations of common data structures (lists, sets, dictionaries...). I find myself always writing the same unit tests over and over, and I'm never sure I'm not forgetting to test some important scenarios.

由于我的班级都实现了标准接口(的IList< T> 的IDictionary< K,V> 等),我想知道是否有某种这些接口的所有实现应该通过引用的单元测试。当然,我还需要测试我的课的具体问题,但至少我会更加有信心,有​​没有在我的实现标准接口坏了。

Since my classes all implement standard interfaces (IList<T>, IDictionary<K,V>, etc), I was wondering if there were some kind of "reference" unit tests that all implementations of these interfaces should pass. Of course I would also need to test the specific aspects of my classes, but at least I would be more confident that there is nothing broken in my implementation of the standard interfaces.

推荐答案

您可以看看在<一个href="https://github.com/mono/mono/tree/master/mcs/class/corlib/Test/System.Collections.Generic">Mono Github上单元测试 - 至少有词典的IList 测试已经有

You could have a look at the Mono unit tests on Github - there is at least Dictionary and IList tests there already.

这篇关于参考单元测试常见的数据结构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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