为什么 Fortran 中的单元测试框架依赖于 Ruby 而不是 Fortran 本身?
总结: FRUIT 只能与 Fortran 编译器一起使用,尽管它的功能可以通过使用 Ruby 来增强。查看作者 Andrew Chen 的以下答案。
=============================================
看来可用的单元测试Fortran 框架 (XUnit) 包括:
乐趣
http://nasarb.rubyforge.org/
水果
http://sourceforge.net/projects/fortranxunit/
flibs
http://flibs.sourceforge.net/
ObjexxFTK(商业)
http://www.objexx.com/ObjexxFTK.html
在他们的网页中,funit、fruit 和 flibs 提到他们依赖Ruby 上运行。我对 ObjexxFTK 不了解。在我看来,Java、C#、Delphi 等中的 XUnit 框架只依赖于相应的语言本身。那么为什么 Fortran 框架选择依赖 Ruby 而不是 Fortran 本身呢?
Summarization: FRUIT can be used only with Fortran compilers, although its functionality can be enhanced by using Ruby. Check the answer below from its author Andrew Chen.
===========================================
It seems that the available unit test frameworks (XUnit) for Fortran include:
funit
http://nasarb.rubyforge.org/
fruit
http://sourceforge.net/projects/fortranxunit/
flibs
http://flibs.sourceforge.net/
ObjexxFTK (commercial)
http://www.objexx.com/ObjexxFTK.html
In their webpages, funit, fruit, and flibs mention they rely on Ruby to function. I have no idea about ObjexxFTK. It seems to me that XUnit frameworks in Java, C#, and Delphi and so forth only rely on the corresponding language itself. Then why do the Fortran frameworks choose to rely on Ruby instead of Fortran itself?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
希辰,
我是陈安德,《水果》的作者。
FRUIT 的核心是纯 FORTRAN 语言。核心功能包括断言、夹具设置、摘要、错误计数和报告。设计目标是具备用自己的语言进行测试的能力。
FRUIT 1.0 大约在 8 年前开发,使用纯 FORTRAN。然后 Ruby 被添加了,Rake 是在 2008 年添加的,我想。
这在 FORTRAN 中尤其重要,因为在构建环境中引入另一种语言或编译器可能是令人望而却步的。
然而,为了使测试框架灵活、优雅和信息丰富,其他更灵活的语言是正确的工具(甚至我的同事仍然认为FORTRAN可以做所有事情,世界是由FORTRAN运行的)。选择 Ruby 是因为它的可读性,并且易于修改。
据我所知,funit 没有 Ruby 就无法运行,但 FRUIT 只能使用 FORTRAN 编译器运行。它已经过Intel F95和g95的测试。
请查看 FRUIT Wiki 中的 2 个教程:
1. 3 分钟内将水果添加到您的饮食中(纯 FORTRAN)
2. 20 分钟内将水果添加到您的饮食中(使用 Ruby)
http:// /sourceforge.net/apps/mediawiki/fortranxunit/index.php?title=Main_Page
希望有帮助。
陈航 陈航
http://blog.sina.com.cn/foreopen
Xichen,
This is Andrew Chen, the author of Fruit.
In the core of FRUIT, it is in pure FORTRAN. The core capability include assert, fixture setup, summary, error counting and report. The design goal is to have the testing capability in the own language.
FRUIT 1.0 was developed about 8 years ago, with pure FORTRAN. Then Ruby was added, Rake was added in 2008, I think.
This is especially important in FORTRAN, because introducing another language or compiler in the build environment may be prohibitive.
However, to make the testing framework flexible, elegant and rich in information, other more flexible language is the right tool (even my co-workers still think FORTRAN can do everything, and the world is run by FORTRAN). Ruby is chosen because of its readability, and easy to modify.
As far as I know, funit cannot run without Ruby, but FRUIT can run with only FORTRAN compilers. It has been tested by Intel F95, and g95.
Please check out the 2 tutorials, in FRUIT Wiki:
1. Add FRUIT into your diet in 3 minutes (pure FORTRAN)
2. Add FRUIT into your diet in 20 minutes (with Ruby)
http://sourceforge.net/apps/mediawiki/fortranxunit/index.php?title=Main_Page
Hope it helps.
Andrew Hang Chen 陈航
http://blog.sina.com.cn/foreopen
在真正为数值分析而设计的 Fortran 中,编写一个具有真正 XUnit 克隆的复杂性、功能和动态特性的单元测试框架将是非常可怕的。
Writing a unit testing framework with the complexity, capability and dynamic nature of a true XUnit clone would be utterly horrendous in Fortran which is really designed for numerical analysis.
这还取决于您对单元测试框架的期望。如果你想要一个 GUI,或者它是 IDE 的插件,那么 fortran 可能不是最简单的方法,即使它当然是可行的。这就是为什么其他语言通常更受青睐的原因。
我用fortran编写了一个简单的fortran单元测试框架,类似于python。基于控制台,但它完成了它的工作。这完全取决于您的需求。 (让我觉得我也许应该将它调整为更通用的用途并发布它。)
当您似乎使用delphi时,您可以将文件对象放入dll中并将它们插入到dunit中。
That depends also on what you expect from a unit test framework. if you want a GUI, or it to be a plugin for an IDE then fortran is maybe not the easiest way to do so, even if it is feasible of course. this is why other languages are often preferred.
I have written a simple unit test framework for fortran in fortran, a la nose for python. console based, but it does its job. it all depends on your needs. (makes me think that i should maybe adapt it to more general use and release it.)
as you seem to be using delphi, you can put your file objects in dlls and plug them to dunit for example.