mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-19 22:19:36 +02:00
fix: generate numbers
This commit is contained in:
87
.idea/workspace.xml
generated
87
.idea/workspace.xml
generated
@@ -5,11 +5,12 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: ToolFileInput.tsx">
|
<list default="true" id="b30e2810-c4c1-4aad-b134-794e52cc1c7d" name="Changes" comment="fix: ToolFileInput.tsx">
|
||||||
<change afterPath="$PROJECT_DIR$/src/components/ToolBreadcrumb.tsx" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/components/ToolHeader.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/ToolHeader.tsx" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/components/Loading.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/Loading.tsx" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/components/ToolLayout.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/ToolLayout.tsx" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/number/generate/generate.service.test.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/generate/generate.service.test.ts" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/tools/defineTool.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/tools/defineTool.tsx" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/pages/number/generate/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/generate/index.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/number/generate/meta.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/generate/meta.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/pages/number/generate/service.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/pages/number/generate/service.ts" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -19,10 +20,13 @@
|
|||||||
<component name="FormatOnSaveOptions">
|
<component name="FormatOnSaveOptions">
|
||||||
<option name="myRunOnSave" value="true" />
|
<option name="myRunOnSave" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="Git.Merge.Settings">
|
||||||
|
<option name="BRANCH" value="origin/chesterking" />
|
||||||
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
<map>
|
<map>
|
||||||
<entry key="$PROJECT_DIR$" value="string-join" />
|
<entry key="$PROJECT_DIR$" value="chesterking" />
|
||||||
</map>
|
</map>
|
||||||
</option>
|
</option>
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
@@ -43,39 +47,40 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent">{
|
<component name="PropertiesComponent"><![CDATA[{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_ADD_EXTERNAL_FILES": "true",
|
"ASKED_ADD_EXTERNAL_FILES": "true",
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"Vitest.compute function (1).executor": "Run",
|
"Vitest.compute function (1).executor": "Run",
|
||||||
"Vitest.compute function.executor": "Run",
|
"Vitest.compute function.executor": "Run",
|
||||||
"Vitest.mergeText.executor": "Run",
|
"Vitest.mergeText.executor": "Run",
|
||||||
"Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run",
|
"Vitest.mergeText.should merge lines and preserve blank lines when deleteBlankLines is false.executor": "Run",
|
||||||
"Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
|
"Vitest.mergeText.should merge lines, preserve blank lines and trailing spaces when both deleteBlankLines and deleteTrailingSpaces are false.executor": "Run",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "C:/Users/HP/IdeaProjects/omni-tools/src/assets",
|
"last_opened_file_path": "C:/Users/HP/IdeaProjects/omni-tools/src/assets",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"npm.dev.executor": "Run",
|
"npm.dev.executor": "Run",
|
||||||
"npm.prebuild.executor": "Run",
|
"npm.lint.executor": "Run",
|
||||||
"npm.script:create:tool.executor": "Run",
|
"npm.prebuild.executor": "Run",
|
||||||
"npm.test.executor": "Run",
|
"npm.script:create:tool.executor": "Run",
|
||||||
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\prettier",
|
"npm.test.executor": "Run",
|
||||||
"project.structure.last.edited": "Problems",
|
"prettierjs.PrettierConfiguration.Package": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\prettier",
|
||||||
"project.structure.proportion": "0.0",
|
"project.structure.last.edited": "Problems",
|
||||||
"project.structure.side.proportion": "0.2",
|
"project.structure.proportion": "0.0",
|
||||||
"settings.editor.selected.configurable": "settings.typescriptcompiler",
|
"project.structure.side.proportion": "0.2",
|
||||||
"ts.external.directory.path": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
|
"settings.editor.selected.configurable": "settings.typescriptcompiler",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"ts.external.directory.path": "C:\\Users\\HP\\IdeaProjects\\omni-tools\\node_modules\\typescript\\lib",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}</component>
|
}]]></component>
|
||||||
<component name="ReactDesignerToolWindowState">
|
<component name="ReactDesignerToolWindowState">
|
||||||
<option name="myId2Visible">
|
<option name="myId2Visible">
|
||||||
<map>
|
<map>
|
||||||
@@ -136,11 +141,11 @@
|
|||||||
<envs />
|
<envs />
|
||||||
<method v="2" />
|
<method v="2" />
|
||||||
</configuration>
|
</configuration>
|
||||||
<configuration name="script:create:tool" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
<configuration name="lint" type="js.build_tools.npm" temporary="true" nameIsGenerated="true">
|
||||||
<package-json value="$PROJECT_DIR$/package.json" />
|
<package-json value="$PROJECT_DIR$/package.json" />
|
||||||
<command value="run" />
|
<command value="run" />
|
||||||
<scripts>
|
<scripts>
|
||||||
<script value="script:create:tool" />
|
<script value="lint" />
|
||||||
</scripts>
|
</scripts>
|
||||||
<node-interpreter value="project" />
|
<node-interpreter value="project" />
|
||||||
<envs />
|
<envs />
|
||||||
@@ -159,10 +164,10 @@
|
|||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
<item itemvalue="npm.dev" />
|
<item itemvalue="npm.dev" />
|
||||||
|
<item itemvalue="npm.test" />
|
||||||
|
<item itemvalue="npm.lint" />
|
||||||
<item itemvalue="Vitest.compute function (1)" />
|
<item itemvalue="Vitest.compute function (1)" />
|
||||||
<item itemvalue="Vitest.compute function" />
|
<item itemvalue="Vitest.compute function" />
|
||||||
<item itemvalue="npm.test" />
|
|
||||||
<item itemvalue="npm.script:create:tool" />
|
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
|
@@ -22,7 +22,7 @@ function FuseLoading(props: FuseLoadingProps) {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Typography
|
<Typography
|
||||||
className="-mb-16 text-13 font-medium sm:text-20"
|
className="text-13 sm:text-20 -mb-16 font-medium"
|
||||||
color="text.secondary"
|
color="text.secondary"
|
||||||
>
|
>
|
||||||
Loading
|
Loading
|
||||||
|
@@ -1,76 +1,76 @@
|
|||||||
// 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', () => {
|
||||||
it('should generate a list of integers with comma separator', () => {
|
it('should generate a list of integers with comma separator', () => {
|
||||||
const initialValue = 1;
|
const initialValue = 1;
|
||||||
const step = 2;
|
const step = 2;
|
||||||
const count = 5;
|
const count = 5;
|
||||||
const separator = ', ';
|
const separator = ', ';
|
||||||
|
|
||||||
const result = listOfIntegers(initialValue, count, step, separator);
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
expect(result).toBe('1, 3, 5, 7, 9');
|
expect(result).toBe('1, 3, 5, 7, 9');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate a list of integers with dash separator', () => {
|
it('should generate a list of integers with dash separator', () => {
|
||||||
const initialValue = 0;
|
const initialValue = 0;
|
||||||
const step = 3;
|
const step = 3;
|
||||||
const count = 4;
|
const count = 4;
|
||||||
const separator = ' - ';
|
const separator = ' - ';
|
||||||
|
|
||||||
const result = listOfIntegers(initialValue, count, step, separator);
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
expect(result).toBe('0 - 3 - 6 - 9');
|
expect(result).toBe('0 - 3 - 6 - 9');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle negative initial value and step', () => {
|
it('should handle negative initial value and step', () => {
|
||||||
const initialValue = -10;
|
const initialValue = -10;
|
||||||
const step = -2;
|
const step = -2;
|
||||||
const count = 5;
|
const count = 5;
|
||||||
const separator = ' ';
|
const separator = ' ';
|
||||||
|
|
||||||
const result = listOfIntegers(initialValue, count, step, separator);
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
expect(result).toBe('-10 -12 -14 -16 -18');
|
expect(result).toBe('-10 -12 -14 -16 -18');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle negative initial value and positive step', () => {
|
it('should handle negative initial value and positive step', () => {
|
||||||
const initialValue = -10;
|
const initialValue = -10;
|
||||||
const step = 2;
|
const step = 2;
|
||||||
const count = 5;
|
const count = 5;
|
||||||
const separator = ' ';
|
const separator = ' ';
|
||||||
|
|
||||||
const result = listOfIntegers(initialValue, count, step, separator);
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
expect(result).toBe('-10 -8 -6 -4 -2');
|
expect(result).toBe('-10 -8 -6 -4 -2');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should float value', () => {
|
it('should float value', () => {
|
||||||
const initialValue = -10;
|
const initialValue = -10;
|
||||||
const step = 2.5;
|
const step = 2.5;
|
||||||
const count = 5;
|
const count = 5;
|
||||||
const separator = ' ';
|
const separator = ' ';
|
||||||
|
|
||||||
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', () => {
|
it('should generate a constant sequence if the step is 0', () => {
|
||||||
const initialValue = 1;
|
const initialValue = 1;
|
||||||
const step = 0;
|
const step = 0;
|
||||||
const count = 5;
|
const count = 5;
|
||||||
const separator = ' ';
|
const separator = ' ';
|
||||||
|
|
||||||
const result = listOfIntegers(initialValue, count, step, separator);
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
expect(result).toBe('1 1 1 1 1');
|
expect(result).toBe('1 1 1 1 1');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate a constant sequence if the step is 0', () => {
|
it('should generate a constant sequence if the step is 0', () => {
|
||||||
const initialValue = 1;
|
const initialValue = 1;
|
||||||
const step = 0;
|
const step = 0;
|
||||||
const count = 5;
|
const count = 5;
|
||||||
const separator = ' ';
|
const separator = ' ';
|
||||||
|
|
||||||
const result = listOfIntegers(initialValue, count, step, separator);
|
const result = listOfIntegers(initialValue, count, step, separator);
|
||||||
expect(result).toBe('1 1 1 1 1');
|
expect(result).toBe('1 1 1 1 1');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -6,7 +6,8 @@ export const tool = defineTool('number', {
|
|||||||
name: 'Generate',
|
name: 'Generate',
|
||||||
path: 'generate',
|
path: 'generate',
|
||||||
// image,
|
// image,
|
||||||
description: '',
|
description:
|
||||||
|
'Quickly calculate a list of integers in your browser. To get your list, just specify the first integer, change value and total count in the options below, and this utility will generate that many integers',
|
||||||
keywords: ['generate'],
|
keywords: ['generate'],
|
||||||
component: lazy(() => import('./index'))
|
component: lazy(() => import('./index'))
|
||||||
});
|
});
|
@@ -1,12 +1,13 @@
|
|||||||
export function listOfIntegers(
|
export function listOfIntegers(
|
||||||
first_value: number,
|
first_value: number,
|
||||||
number_of_numbers: number,
|
number_of_numbers: number,
|
||||||
step: number,
|
step: number,
|
||||||
separator: string) {
|
separator: string
|
||||||
const result: number[] = [];
|
) {
|
||||||
for (let i: number = 0; i < number_of_numbers; i++) {
|
const result: number[] = [];
|
||||||
const value: number = first_value + i * step;
|
for (let i: number = 0; i < number_of_numbers; i++) {
|
||||||
result.push(value);
|
const value: number = first_value + i * step;
|
||||||
}
|
result.push(value);
|
||||||
return result.join(separator);
|
}
|
||||||
}
|
return result.join(separator);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user