是否有任何用 C/C++ 编码的回归测试?测试 CString (ATL/MFC) 的所有功能?
我正在尝试将 ATL/MFC 中的 CString 与自定义 CString 实现进行比较,并且我想确保自定义实现中的所有功能都与 ATL/MFC 实现的功能相匹配。
我们拥有自定义 CString 实现的原因是我们可以在 *nix 和 Windows 平台上使用它。接口是相同的,但实现不同,因此当我们移植 Windows 代码以使用我们正在编写的 SDK 时,我们不必更改所有名称...我们只需要找出两者之间的差异实施。
对此的任何帮助将不胜感激。谢谢!
I am trying to do a comparison of CString from ATL/MFC to a custom CString implementation and I want to make sure that all the functionality in the custom implementation matches that of the ATL/MFC implementation.
The reason we have a custom CString implementation is so that we can use it on *nix and Windows platforms. The interface is the same, but the implementation is different so when we port our Windows code to use the SDK we are writing we don't have to change ALL the names ... we will only have to work out the differences between the two implementations.
Any help on this would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就我个人而言,我想不出任何。但是,如果我这样做,我会对我拥有的所有用例进行编码,并确保我拥有一个测试来覆盖它。
另外,在 Windows 上,您委托给提供的实现还是您自己的实现?如果您委托他人,您会发现您的测试更有用,因为它们可以突出差异。
祝你好运,
Personally I cannot think of any. However if I were doing it I would encode all the use cases I have for it and make sure I owned a test to cover it.
Also on windows do you delegate to the supplied implementaton or your own? If you delegated you could find your tests more useful as they could highlight differences.
Good luck,
CString 提供了一整套从 ATLCStringT 继承的模板和运算符重载。
为了能够使用 ATL 算法或结构,您需要实现所有内容(CMAP)。
但是,如果您将它用作基本的 char* 包装器,那么应该没问题。
请注意,在 Visual Studio 下编译时,CString 比默认的 std::string 更优化。
CString provides a whole host of template and operator overloads which it inherets from the ATLCStringT.
To be able to use ATL algorithms or structures you would need to implement everything(CMAP).
If you however use it as a basic char* wrapper you should be fine.
Note that CString is more optimal when compiled under Visual Studio than default std::string.