我有适用于 Mac 的 Mathematica 8.0 和 Wolfram Workbench 2.0。我想使用 MUnit 对我正在创建的包进行单元测试,但我发现缺少有关 MUnit 的文档令人沮丧。
最好的资源是 Mathematic Cookbook by Sal Mangano .第 19.11 节涵盖“将 Wolfram Workbench 的 MUnit 包集成到前端”。
我想一旦我将 MUnit 暴露给前端,我将能够使用 ? .只是一个问题,我找不到 MUnit 包。我试图找到书中建议的 MUnit 目录:
find / -name MUnit -print 2> /dev/null
,但没有任何运气。
最佳答案
如果您对这个答案投了赞成票,请也给 Szabolcs 的答案投上赞成票,从而向他展示一些热情。他在这方面提供了巨大的帮助。
MUnit 的位置取决于 Wolfram Workbench 功能首次使用的顺序。这只是一个理论,但它解释了为什么find
最初无法找到 MUnit,但现在找到了。在我的系统上,MUnit 位于:
/Applications/Wolfram\ Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Head/MUnit
要使用 Wolfram Workbench 在您的系统上定位 MUnit:
TestID->"MyTest-20111230-L0X3S3"
时你将进入 Test.m。 . 使用
find
在您的系统上定位 MUnit :find / -name MUnit -print 2> /dev/null
find
结果:/Applications/Wolfram Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Head/MUnit
/Applications/Wolfram Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Version5.2/MUnit
/Applications/Wolfram Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Version6/MUnit
找到位置后,您可以使用以下命令查询 MUnit 包: (注意:路径很可能略有不同)
AppendTo[$Path,
FileNameJoin[{"/", "Applications", "Wolfram Workbench.app",
"configuration", "org.eclipse.osgi", "bundles", "214", "1", ".cp",
"MathematicaSourceVersioned", "Head", "MUnit"}]];
Needs["MUnit`"];
?MUnit`*
(* Need a blank line after ?MUnit`* otherwise a nasty message is generated. *)
关于wolfram-mathematica - Mac 版 Wolfram Workbench 2.0 中 MUnit 的位置在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8684052/