gpt4 book ai didi

wolfram-mathematica - Mac 版 Wolfram Workbench 2.0 中 MUnit 的位置在哪里?

转载 作者:行者123 更新时间:2023-12-04 06:25:04 26 4
gpt4 key购买 nike

我有适用于 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。 .
  • 将鼠标悬停在 Test.m 的选项卡上,您将看到 Test.m 的位置。

  • location to Test.m in Mac version

    使用 find 在您的系统上定位 MUnit :
  • 在 Wolfram Workbench 中创建一个测试用例。
  • 打开终端并输入: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/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com