-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
front: add speedlimits boundaries to simulation export to csv
Signed-off-by: Alice K. <[email protected]>
- Loading branch information
Alice K.
committed
Feb 17, 2025
1 parent
f1b10fb
commit 02974c0
Showing
3 changed files
with
55 additions
and
42 deletions.
There are no files selected for viewing
28 changes: 14 additions & 14 deletions
28
front/src/modules/simulationResult/SimulationResultExport/__tests__/utils.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import { describe, it, expect } from 'vitest'; | ||
|
||
import { findActualVmax } from '../utils'; | ||
import { findActualVmaxs } from '../utils'; | ||
|
||
describe('findActualVmax', () => { | ||
const vMax = { internalBoundaries: [2000, 3400, 5300, 6000], speeds: [10, 100, 200, 100, 150] }; | ||
|
||
it('should return the correct Vmax', () => { | ||
const result = findActualVmax(2500, vMax); | ||
expect(result).toEqual(100); | ||
it('should return the correct Vmax when the givenPosition is in an intermediary interval', () => { | ||
const result = findActualVmaxs(2500, vMax); | ||
expect(result).toEqual([100]); | ||
}); | ||
|
||
it('should return the correct Vmax when the givenPosition is in the last interval', () => { | ||
const result = findActualVmax(7000, vMax); | ||
expect(result).toEqual(150); | ||
const result = findActualVmaxs(7000, vMax); | ||
expect(result).toEqual([150]); | ||
}); | ||
|
||
it('should return the correct Vmax when the givenPosition is in thefirst interval', () => { | ||
const result = findActualVmax(1000, vMax); | ||
expect(result).toEqual(10); | ||
const result = findActualVmaxs(1000, vMax); | ||
expect(result).toEqual([10]); | ||
}); | ||
|
||
it('should return the min Vmax when givenPosition is equal to a boundary (min before)', () => { | ||
const result = findActualVmax(3400, vMax); | ||
expect(result).toEqual(100); | ||
it('should return both Vmax before and after when givenPosition is equal to a boundary (min before)', () => { | ||
const result = findActualVmaxs(3400, vMax); | ||
expect(result).toEqual([100, 200]); | ||
}); | ||
|
||
it('should return the min Vmax when givenPosition is equal to a boundary (min after)', () => { | ||
const result = findActualVmax(5300, vMax); | ||
expect(result).toEqual(100); | ||
it('should return both Vmax before and after when givenPosition is equal to a boundary (min after)', () => { | ||
const result = findActualVmaxs(5300, vMax); | ||
expect(result).toEqual([200, 100]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters