예제 #1
0
        public void TestBench_Invalid()
        {
            string XmePath       = Path.GetFullPath(@"..\..\..\..\models\CADTeam\MSD_CAD.xme");
            string TestbenchPath = "/@MyTestBenches|kind=Testing|relpos=0/@TestBench_Config|kind=Testing|relpos=0/@CADAssembly|kind=Testing|relpos=0/@TestBench_Invalid|kind=TestBench|relpos=0";
            string OutputDir     = Path.Combine(Path.GetDirectoryName(XmePath), "TestBench_Invalid");

            bool status = CyPhy2CADRun.Run(OutputDir, XmePath, TestbenchPath);

            Assert.False(File.Exists(Path.Combine(OutputDir, generatedAsmFile)), "Failed to generate " + generatedAsmFile);
        }
예제 #2
0
        public void BlastTB_Predefined_Valid()
        {
            string XmePath       = Path.GetFullPath(@"..\..\..\..\models\CADTeam\MSD_CAD.xme");
            string TestbenchPath = "/@MyTestBenches|kind=Testing|relpos=0/@TestBench_Config|kind=Testing|relpos=0/@Blast|kind=Testing|relpos=0/@Predefined_Blast_Valid|kind=BlastTestBench|relpos=0";
            string OutputDir     = Path.Combine(Path.GetDirectoryName(XmePath), "BlastTB_Predefined_Valid");

            bool status = CyPhy2CADRun.Run(OutputDir, XmePath, TestbenchPath);

            Assert.True(File.Exists(Path.Combine(OutputDir, generatedAsmFile)), "Failed to generate " + generatedAsmFile);
            Assert.True(File.Exists(Path.Combine(OutputDir, generatedBlastConfig)), "Failed to generate " + generatedBlastConfig);

            new AsmXmlChecker(Path.Combine(OutputDir, generatedAsmFile));
        }
예제 #3
0
        public void CFD_Failure_WaveVelocityInvalidTempInvalidFreqInvalid()
        {
            string XmePath       = Path.GetFullPath(@"..\..\..\..\models\CFD\SolverSettings\wigley_hull.xme");
            string TestbenchPath =
                "/@CFD_Testing|kind=Testing|relpos=0/@FAILURES|kind=Testing|relpos=0/@WaveVelocityInvalidTempInvalidFreqInvalid|kind=CFDTestBench|relpos=0";
            string OutputDir = Path.Combine(Path.GetDirectoryName(XmePath), "CFD_WaveVelocityInvalidTempInvalidFreqInvalid");

            string cfdGeneratedDir           = Path.Combine(OutputDir, "CFD");
            string cfdOutputJson             = Path.Combine(cfdGeneratedDir, "CFDConfig.json");
            string generatedAssemblyFilePath = Path.Combine(OutputDir, generatedAsmFile);

            bool status = CyPhy2CADRun.Run(OutputDir, XmePath, TestbenchPath);

            Assert.False(File.Exists(generatedAssemblyFilePath), generatedAsmFile + " was generated");
            Assert.False(File.Exists(cfdOutputJson), "CFDConfig.json was generated");
        }
예제 #4
0
        public void BallisticTB_Custom_Valid()
        {
            string XmePath       = Path.GetFullPath(@"..\..\..\..\models\CADTeam\MSD_CAD.xme");
            string TestbenchPath = "/@MyTestBenches|kind=Testing|relpos=0/@TestBench_Config|kind=Testing|relpos=0/@Ballistic|kind=Testing|relpos=0/@Custom_Ballistics_Valid|kind=BallisticTestBench|relpos=0";
            string OutputDir     = Path.Combine(Path.GetDirectoryName(XmePath), "BallisticTB_Custom_Valid");

            bool status = CyPhy2CADRun.Run(OutputDir, XmePath, TestbenchPath);

            Assert.True(File.Exists(Path.Combine(OutputDir, generatedAsmFile)), "Failed to generate " + generatedAsmFile);
            Assert.True(File.Exists(Path.Combine(OutputDir, generatedBallisticConfig)), "Failed to generate " + generatedBallisticConfig);

            new AsmXmlChecker(Path.Combine(OutputDir, generatedAsmFile))

            .CheckComponentAttribute("{f6cf014a-caeb-440a-b2b1-d700fe99e652}", "Representation", "BuyRep_Test")
            .CheckComponentAttribute("{f4a87e6b-4ce4-46d9-92cc-28b19ee61399}", "Representation", "DefaultRep_Test")
            .CheckComponentAttribute("{94353ed0-bf00-40d3-9d22-b14c70271460}", "Representation", "MakeRep_Test");
        }
예제 #5
0
        public void CFD_Success()
        {
            string XmePath       = Path.GetFullPath(@"..\..\..\..\models\CFD\SolverSettings\wigley_hull.xme");
            string TestbenchPath = "/@CFD_Testing|kind=Testing|relpos=0/@CFD_Success|kind=CFDTestBench|relpos=0";
            string OutputDir     = Path.Combine(Path.GetDirectoryName(XmePath), "CFD_Success_Output");

            string cfdGeneratedDir           = Path.Combine(OutputDir, "CFD");
            string cfdOutputJson             = Path.Combine(cfdGeneratedDir, "CFDConfig.json");
            string generatedAssemblyFilePath = Path.Combine(OutputDir, generatedAsmFile);

            bool status = CyPhy2CADRun.Run(OutputDir, XmePath, TestbenchPath);

            Assert.True(File.Exists(generatedAssemblyFilePath), "Failed to generate " + generatedAsmFile);
            Assert.True(File.Exists(cfdOutputJson), "Failed to generate CFDConfig.json!");

            new AsmXmlChecker(Path.Combine(OutputDir, generatedAsmFile));
        }
예제 #6
0
        public void Connectors_Invalid()
        {
            string XmePath          = Path.GetFullPath(@"..\..\..\..\models\CADTeam\MSD_CAD.xme");
            string OutputDir        = Path.Combine(Path.GetDirectoryName(XmePath), "Connectors_Invalid");
            var    generatedAsmPath = Path.Combine(OutputDir, generatedAsmFile);

            CyPhyGUIs.CyPhyDirectory.EnsureEmptyDirectory(OutputDir);

            string ProjectConnStr;

            MgaUtils.ImportXMEForTest(XmePath, Path.Combine(OutputDir, Path.GetFileNameWithoutExtension(XmePath) + "_CADtest.mga"), out ProjectConnStr);
            CyPhy2CADRun.CopyDirectory(Path.Combine(Path.GetDirectoryName(XmePath), "components"), Path.Combine(Path.Combine(OutputDir, "components")));

            MgaProject project = new MgaProject();
            bool       ro_mode;

            project.Open(ProjectConnStr, out ro_mode);
            try
            {
                // testbenchpath doesn't work:(
                var terr    = project.BeginTransactionInNewTerr();
                var testObj = project.RootFolder.GetObjectByPathDisp("/@Generated_configurations/MyMassSpringDamper/Config1/MyMassSpringDamper_cfg_broken");
                project.AbortTransaction();

                bool status = CyPhy2CADRun.Run(Path.GetDirectoryName(XmePath), project, (MgaFCO)testObj, false);

                string logfilename = Path.Combine(OutputDir, "log", CyPhy2CAD_CSharp.Logger.LogFileName);

                StreamReader r          = new StreamReader(logfilename);
                string       logcontent = r.ReadToEnd();

                Assert.True(logcontent.Contains("badname"));
            }
            finally
            {
                project.Close(abort: true);
            }
        }