Skip to content

Commit 240f0df

Browse files
committed
test: add tests and its fixtures
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 1e45096 commit 240f0df

File tree

11 files changed

+1059
-0
lines changed

11 files changed

+1059
-0
lines changed

lib/node_modules/@stdlib/math/base/special/sincosd/test/fixtures/julia/huge_negative.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/sincosd/test/fixtures/julia/huge_positive.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/sincosd/test/fixtures/julia/large_negative.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/sincosd/test/fixtures/julia/large_positive.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/sincosd/test/fixtures/julia/medium_negative.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

lib/node_modules/@stdlib/math/base/special/sincosd/test/fixtures/julia/medium_positive.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/usr/bin/env julia
2+
#
3+
# @license Apache-2.0
4+
#
5+
# Copyright (c) 2025 The Stdlib Authors.
6+
#
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
import JSON
20+
21+
"""
22+
gen( domain, filepath )
23+
24+
Generate fixture data and write to file.
25+
26+
# Arguments
27+
28+
* `domain`: domain
29+
* `filepath::AbstractString`: filepath of the output file
30+
31+
# Examples
32+
33+
``` julia
34+
julia> x = range( -1000.0, stop = 1000.0, length = 2001 );
35+
julia> gen( x, \"./data.json\" );
36+
```
37+
"""
38+
function gen( domain, filepath )
39+
x = collect( domain );
40+
s = sind.( x );
41+
c = cosd.( x );
42+
data = Dict([
43+
("x", x),
44+
("sine", s),
45+
("cosine", c)
46+
]);
47+
outfile = open( filepath, "w" );
48+
write( outfile, JSON.json(data) );
49+
write( outfile, "\n" );
50+
close( outfile );
51+
end
52+
53+
# Get the filename:
54+
file = @__FILE__;
55+
56+
# Extract the directory in which this file resides:
57+
dir = dirname( file );
58+
59+
# Negative medium sized values:
60+
x = range( -256.0*180.0, stop = 0.0, length = 4000 );
61+
out = joinpath( dir, "medium_negative.json" );
62+
gen( x, out );
63+
64+
# Positive medium sized values:
65+
x = range( 0.0, stop = 256.0*180.0, length = 4000 );
66+
out = joinpath( dir, "medium_positive.json" );
67+
gen( x, out );
68+
69+
# Negative large values:
70+
x = range( -2.0^20*(180.0/2.0), stop = -2.0^60*(180.0/2.0), length = 4000 );
71+
out = joinpath( dir, "large_negative.json" );
72+
gen( x, out );
73+
74+
# Positive large values:
75+
x = range( 2.0^20*(180.0/2.0), stop = 2.0^60*(180.0/2.0), length = 4000 );
76+
out = joinpath( dir, "large_positive.json" );
77+
gen( x, out );
78+
79+
# Negative huge values:
80+
x = range( -2.0^60*(180.0/2.0), stop = -2.0^1000*(180.0/2.0), length = 4000 );
81+
out = joinpath( dir, "huge_negative.json" );
82+
gen( x, out );
83+
84+
# Positive huge values:
85+
x = range( 2.0^60*(180.0/2.0), stop = 2.0^1000*(180.0/2.0), length = 4000 );
86+
out = joinpath( dir, "huge_positive.json" );
87+
gen( x, out );

0 commit comments

Comments
 (0)