Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ligths Implemented #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,19 @@ The figure below illustrates this behavior using an example.
1. As the joystick remains at a positive value, the reference speed is incremented again.
1. However, it reaches the speed limit so in the next step it is not incremented even though the joystick still has a positive value.
1. Later, the joystick is set to a negative position for one time unit, making the reference speed to decrease as well.

# My Added extra lines

```bash
#this is how I cloned this repository
git clone https://github.com/Tiegris/base
```

Here is a hierarchical list

- Main category 1
- sub category 1.1
- sub category 1.2
- Main caetogory 2


Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ public class TrainControllerImpl implements TrainController {
private int step = 0;
private int referenceSpeed = 0;
private int speedLimit = 0;
private boolean lights = false;

public boolean toggleLights() { return this.lights = !this.lights; }

public boolean getLights() { return lights; }

@Override
public void followSpeed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ public interface TrainController {

void setJoystickPosition(int joystickPosition);

boolean toggleLights();

boolean getLights();

Comment on lines +13 to +16
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A setLights(bool) function would have been nice too, but ok.

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,16 @@ public void before() {

sensor.overrideSpeedLimit(50);
}


@Test
public void LightsTest() {
Assert.assertFalse(controller.getLights());
Assert.assertTrue(controller.toggleLights());

Assert.assertTrue(controller.getLights());
Assert.assertFalse(controller.toggleLights());
}

@Test
public void OverridingJoystickPosition_IncreasesReferenceSpeed() {
sensor.overrideSpeedLimit(10);
Expand Down