Skip to content

Commit

Permalink
Add Tag and type description for ValuedParameterDescriptor (#626)
Browse files Browse the repository at this point in the history
Add test coverage
  • Loading branch information
sciencewhiz authored Dec 7, 2024
1 parent ee33170 commit b143da9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/robotbuilder/utils/YamlUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class YamlUtils {
tag.getClassName().equals(ListProperty.class.getName()) ||
tag.getClassName().equals(TeamNumberProperty.class.getName()) ||
tag.getClassName().equals(ParameterDescriptor.class.getName()) ||
tag.getClassName().equals(ValuedParameterDescriptor.class.getName()) ||

tag.getClassName().equals(DistinctValidator.class.getName()) ||
tag.getClassName().equals(ExistsValidator.class.getName()) ||
Expand Down Expand Up @@ -74,6 +75,7 @@ public class YamlUtils {
constructor.addTypeDescription(new TypeDescription(ListProperty.class, "!ListProperty"));
constructor.addTypeDescription(new TypeDescription(TeamNumberProperty.class, "!TeamNumberProperty"));
constructor.addTypeDescription(new TypeDescription(ParameterDescriptor.class, "!ParameterDescriptor"));
constructor.addTypeDescription(new TypeDescription(ValuedParameterDescriptor.class, "!ValuedParameterDescriptor"));

constructor.addTypeDescription(new TypeDescription(DistinctValidator.class, "!DistinctValidator"));
constructor.addTypeDescription(new TypeDescription(ExistsValidator.class, "!ExistsValidator"));
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/robotbuilder/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package robotbuilder;

import robotbuilder.data.RobotWalker;
import robotbuilder.data.properties.ConstantsProperty;
import robotbuilder.data.properties.ValuedParameterDescriptor;
import robotbuilder.exporters.GenericExporter;
import robotbuilder.robottree.RobotTree;

Expand Down Expand Up @@ -98,6 +100,9 @@ public static RobotTree generateTestTree() {
wrist.add(wristMotor);
RobotComponent pot = new RobotComponent("Pot", "Analog Potentiometer", tree);
wrist.add(pot);
ValuedParameterDescriptor setpoint = new ValuedParameterDescriptor("InSP", "double", 1.0);
ConstantsProperty setpoints = new ConstantsProperty("Setpoints", List.of(setpoint), null, null);
wrist.getProperty("Constants").setValueAndUpdate(setpoints);

// Create a misc subsystem
RobotComponent misc = new RobotComponent("Misc", "Subsystem", tree);
Expand Down

0 comments on commit b143da9

Please sign in to comment.