mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 14:09:31 +02:00
testing the case step equal to 0
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// Import necessary modules and functions
|
// Import necessary modules and functions
|
||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import { listOfIntegers } from './service';
|
import { listOfIntegers} from './service';
|
||||||
|
|
||||||
// Define test cases for the listOfIntegers function
|
// Define test cases for the listOfIntegers function
|
||||||
describe('listOfIntegers function', () => {
|
describe('listOfIntegers function', () => {
|
||||||
@@ -53,4 +53,24 @@ describe('listOfIntegers function', () => {
|
|||||||
const result = listOfIntegers(initialValue, count, step, separator);
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
expect(result).toBe('-10 -7.5 -5 -2.5 0');
|
expect(result).toBe('-10 -7.5 -5 -2.5 0');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should generate a constant sequence if the step is 0', () => {
|
||||||
|
const initialValue = 1;
|
||||||
|
const step = 0;
|
||||||
|
const count = 5;
|
||||||
|
const separator = ' ';
|
||||||
|
|
||||||
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
|
expect(result).toBe('1 1 1 1 1');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should generate a constant sequence if the step is 0', () => {
|
||||||
|
const initialValue = 1;
|
||||||
|
const step = 0;
|
||||||
|
const count = 5;
|
||||||
|
const separator = ' ';
|
||||||
|
|
||||||
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
|
expect(result).toBe('1 1 1 1 1');
|
||||||
|
});
|
||||||
});
|
});
|
Reference in New Issue
Block a user