Open robbr48 opened 4 years ago
This is tested by the DefaultLibraryXMLTest, warnings are printed for those components where it is missing, we could turn those warnings into a test failure
That's a good idea! But I was thinking that this issue may require more than one PR, so that multiple people may help out when they have the time. We should not change the tests until the last PR then, so that the previous PRs can be merged.
And also, we should write here which libraries we are currently working on to avoid duplicate work.
Actually there is only a handfull missing (if the test is correct) most of them auto generated from Mathematica. So I thing one person can do it. ( if they have access to.mathematic and know how to regenerate the components), just run the test in a terminal to see which are missing.
I get the following output
WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component ElectricMotorGearScrewLink! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component HydraulicOrificeG! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component HydraulicOrificeCheckValveG! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component HydraulicPiston! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component HydraulicPressureControlledPumpG! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component HydraulicPressureReducingValveG! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component HydraulicPistonAckumulator! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component MechanicM2load1D! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component MechanicMkcload1D! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component MechanicGearClutch! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component MechanicGearShaft! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component PneumaticMachine! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component CppComponent! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component ModelicaComponent! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component AeroAircraft6DOFSS! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component AeroCombustionChamberMono! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component AeroVehicleTVC! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component AeroWind! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component MechanicGear! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)] WARNING: DefaultLibraryXMLTest::testSourceCodeLink() SourceCode attribute not set for component MechanicM3load1D! Loc: [../../../hopsan-code/UnitTests/DefaultLibraryXMLTest/tst_defaultlibraryxmltest.cpp(237)]
Most of these are Mathematica components. I wonder if we should really specify the generated hpp file as source code, or let it be for now? The Mathematica file cannot be opened by Hopsan anyway.
Some of the mathematica files could generate html "documentation"
Is your improvement request related to a problem? Please describe. You often want to view the source code for default components, either to understand how they are implemented or for creating a code skeleton for creating new components.
Describe the solution you'd like Specify the source code file in component appearance file (.xml) for each component in default library.