mmo*_*ris 8 wolfram-mathematica
我有适用于Mac的Mathematica 8.0和Wolfram Workbench 2.0.我想使用MUnit对我正在创建的包进行单元测试,但我发现MUnit上缺少文档令人沮丧.
Sal Mangano的Mathematic Cookbook是最好的资源.第19.11节介绍了"将Wolfram Workbench的MUnit包集成到前端".
我想一旦我将MUnit暴露给前端,我将能够查询MUnit API?.只有一个问题,我找不到MUnit包.我尝试按照书中的建议找到MUnit目录:
find / -name MUnit -print 2> /dev/null
Run Code Online (Sandbox Code Playgroud)
,但没有运气.
如果你对这个答案进行投票,请向Szabolcs表示他的回答.他对此非常有帮助.
MUnit的位置取决于首次使用Wolfram Workbench功能的顺序.这只是一个理论,但它解释了为什么find最初无法找到MUnit,但现在却找到了.在我的系统上,MUnit位于:
/Applications/Wolfram\ Workbench.app/configuration/org.eclipse.osgi/bundles/214/1/.cp/MathematicaSourceVersioned/Head/MUnit
Run Code Online (Sandbox Code Playgroud)
要使用Wolfram Workbench在您的系统上找到MUnit:
TestID->"MyTest-20111230-L0X3S3".
使用find以下方法在系统上查找MUnit :
find / -name MUnit -print 2> /dev/nullfind 结果:
/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
Run Code Online (Sandbox Code Playgroud)
找到位置后,您可以使用以下方式查询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. *)
Run Code Online (Sandbox Code Playgroud)
我找到MUnit.m了
...\configuration\org.eclipse.osgi\bundles\347\1\.cp\MathematicaSourceVersioned\Head\MUnit
Run Code Online (Sandbox Code Playgroud)
在Eclipse(或Workbench)安装目录中.我没有Mac,但无论平台如何,它都应该在同一个地方.
Mathematica 6和5.2还有另外两个版本(Head用Version5.2或替换路径Version6).