Skip to content

Commit fccc0b2

Browse files
chore: update runner.jl to follow current project conventions
PR-URL: #5988 Reviewed-by: Athan Reines <[email protected]>
1 parent d8fc3a6 commit fccc0b2

File tree

3 files changed

+50
-43
lines changed
  • lib/node_modules/@stdlib/math/base/special

3 files changed

+50
-43
lines changed

lib/node_modules/@stdlib/math/base/special/sincos/test/fixtures/julia/runner.jl

100644100755
+18-17
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,38 @@
1919
import JSON
2020

2121
"""
22-
gen( domain, filepath )
22+
gen( domain, name )
2323
2424
Generate fixture data and write to file.
2525
2626
# Arguments
2727
2828
* `domain`: domain
29-
* `filepath::AbstractString`: filepath of the output file
29+
* `name::AbstractString`: output filename
3030
3131
# Examples
3232
3333
``` julia
34-
julia> x = range( -1000.0, stop = 1000.0, length = 2001 );
35-
julia> gen( x, \"./data.json\" );
34+
julia> x = linspace( -1000, 1000, 2001 );
35+
julia> gen( x, \"data.json\" );
3636
```
3737
"""
38-
function gen( domain, filepath )
38+
function gen( domain, name )
3939
x = collect( domain );
4040
s = sin.( x );
4141
c = cos.( x );
42+
43+
# Store data to be written to file as a collection:
4244
data = Dict([
4345
("x", x),
4446
("sine", s),
4547
("cosine", c)
4648
]);
49+
50+
# Based on the script directory, create an output filepath:
51+
filepath = joinpath( dir, name );
52+
53+
# Write the data to the output filepath as JSON:
4754
outfile = open( filepath, "w" );
4855
write( outfile, JSON.json(data) );
4956
write( outfile, "\n" );
@@ -58,30 +65,24 @@ dir = dirname( file );
5865

5966
# Negative medium sized values:
6067
x = range( -256.0*pi, stop = 0.0, length = 4000 );
61-
out = joinpath( dir, "medium_negative.json" );
62-
gen( x, out );
68+
gen( x, "medium_negative.json" );
6369

6470
# Positive medium sized values:
6571
x = range( 0.0, stop = 256.0*pi, length = 4000 );
66-
out = joinpath( dir, "medium_positive.json" );
67-
gen( x, out );
72+
gen( x, "medium_positive.json" );
6873

6974
# Negative large values:
7075
x = range( -2.0^20*(pi/2.0), stop = -2.0^60*(pi/2.0), length = 4000 );
71-
out = joinpath( dir, "large_negative.json" );
72-
gen( x, out );
76+
gen( x, "large_negative.json" );
7377

7478
# Positive large values:
7579
x = range( 2.0^20*(pi/2.0), stop = 2.0^60*(pi/2.0), length = 4000 );
76-
out = joinpath( dir, "large_positive.json" );
77-
gen( x, out );
80+
gen( x, "large_positive.json" );
7881

7982
# Negative huge values:
8083
x = range( -2.0^60*(pi/2.0), stop = -2.0^1000*(pi/2.0), length = 4000 );
81-
out = joinpath( dir, "huge_negative.json" );
82-
gen( x, out );
84+
gen( x, "huge_negative.json" );
8385

8486
# Positive huge values:
8587
x = range( 2.0^60*(pi/2.0), stop = 2.0^1000*(pi/2.0), length = 4000 );
86-
out = joinpath( dir, "huge_positive.json" );
87-
gen( x, out );
88+
gen( x, "huge_positive.json" );

lib/node_modules/@stdlib/math/base/special/sincosd/test/fixtures/julia/runner.jl

+18-17
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,38 @@
1919
import JSON
2020

2121
"""
22-
gen( domain, filepath )
22+
gen( domain, name )
2323
2424
Generate fixture data and write to file.
2525
2626
# Arguments
2727
2828
* `domain`: domain
29-
* `filepath::AbstractString`: filepath of the output file
29+
* `name::AbstractString`: output filename
3030
3131
# Examples
3232
3333
``` julia
34-
julia> x = range( -1000.0, stop = 1000.0, length = 2001 );
35-
julia> gen( x, \"./data.json\" );
34+
julia> x = linspace( -1000, 1000, 2001 );
35+
julia> gen( x, \"data.json\" );
3636
```
3737
"""
38-
function gen( domain, filepath )
38+
function gen( domain, name )
3939
x = collect( domain );
4040
s = sind.( x );
4141
c = cosd.( x );
42+
43+
# Store data to be written to file as a collection:
4244
data = Dict([
4345
("x", x),
4446
("sine", s),
4547
("cosine", c)
4648
]);
49+
50+
# Based on the script directory, create an output filepath:
51+
filepath = joinpath( dir, name );
52+
53+
# Write the data to the output filepath as JSON:
4754
outfile = open( filepath, "w" );
4855
write( outfile, JSON.json(data) );
4956
write( outfile, "\n" );
@@ -58,30 +65,24 @@ dir = dirname( file );
5865

5966
# Negative medium sized values:
6067
x = range( -256.0*180.0, stop = 0.0, length = 4000 );
61-
out = joinpath( dir, "medium_negative.json" );
62-
gen( x, out );
68+
gen( x, "medium_negative.json" );
6369

6470
# Positive medium sized values:
6571
x = range( 0.0, stop = 256.0*180.0, length = 4000 );
66-
out = joinpath( dir, "medium_positive.json" );
67-
gen( x, out );
72+
gen( x, "medium_positive.json" );
6873

6974
# Negative large values:
7075
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 );
76+
gen( x, "large_negative.json" );
7377

7478
# Positive large values:
7579
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 );
80+
gen( x, "large_positive.json" );
7881

7982
# Negative huge values:
8083
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 );
84+
gen( x, "huge_negative.json" );
8385

8486
# Positive huge values:
8587
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 );
88+
gen( x, "huge_positive.json" );

lib/node_modules/@stdlib/math/base/special/sincospi/test/fixtures/julia/runner.jl

100644100755
+14-9
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,38 @@
1919
import JSON
2020

2121
"""
22-
gen( domain, filepath )
22+
gen( domain, name )
2323
2424
Generate fixture data and write to file.
2525
2626
# Arguments
2727
2828
* `domain`: domain
29-
* `filepath::AbstractString`: filepath of the output file
29+
* `name::AbstractString`: output filename
3030
3131
# Examples
3232
3333
``` julia
34-
julia> x = range( -1000, stop = 1000, length = 2001 );
35-
julia> gen( x, \"./data.json\" );
34+
julia> x = linspace( -1000, 1000, 2001 );
35+
julia> gen( x, \"data.json\" );
3636
```
3737
"""
38-
function gen( domain, filepath )
38+
function gen( domain, name )
3939
x = collect( domain );
4040
s = sinpi.( x );
4141
c = cospi.( x );
42+
43+
# Store data to be written to file as a collection:
4244
data = Dict([
4345
("x", x),
4446
("sin", s),
4547
("cos", c)
4648
]);
49+
50+
# Based on the script directory, create an output filepath:
51+
filepath = joinpath( dir, name );
52+
53+
# Write the data to the output filepath as JSON:
4754
outfile = open( filepath, "w" );
4855
write( outfile, JSON.json(data) );
4956
write( outfile, "\n" );
@@ -58,10 +65,8 @@ dir = dirname( file );
5865

5966
# Generate fixture data for integer values:
6067
x = range( -1000.0, stop = 1000.0, length = 2001 );
61-
out = joinpath( dir, "integers.json" );
62-
gen( x, out );
68+
gen( x, "integers.json" );
6369

6470
# Generate fixture data for decimal values:
6571
x = range( -100.0, stop = 100.0, length = 2003 )
66-
out = joinpath( dir, "decimals.json" );
67-
gen( x, out );
72+
gen( x, "decimals.json" );

0 commit comments

Comments
 (0)