-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sigma] Adds new rendering util numberToGLSLFloat
Details: - Deletes numberToGLSLFloat from node-border and node-piechart - Replaces them by numberToGLSLFloat, exported from sigma/rendering - Adds some unit tests for this helper
- Loading branch information
Showing
6 changed files
with
34 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { numberToGLSLFloat } from "sigma/rendering"; | ||
import { describe, expect, test } from "vitest"; | ||
|
||
describe("rendering utils", () => { | ||
describe("numberToGLSLFloat", () => { | ||
test('it should properly print all kind of numbers to "GLSL float" strings', () => { | ||
const tests: [number, string][] = [ | ||
[1, "1.0"], | ||
[123, "123.0"], | ||
[1.23, "1.23"], | ||
[0.123, "0.123"], | ||
[1230, "1230.0"], | ||
[12300, "12300.0"], | ||
[1e-6, "0.000001"], | ||
[1e6, "1000000.0"], | ||
]; | ||
|
||
tests.forEach(([input, expectedOutput]) => expect(numberToGLSLFloat(input)).toBe(expectedOutput)); | ||
}); | ||
}); | ||
}); |