Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update runner.jl to follow current project conventions #5988

Merged
merged 1 commit into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions lib/node_modules/@stdlib/math/base/special/sincos/test/fixtures/julia/runner.jl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,38 @@
import JSON

"""
gen( domain, filepath )
gen( domain, name )

Generate fixture data and write to file.

# Arguments

* `domain`: domain
* `filepath::AbstractString`: filepath of the output file
* `name::AbstractString`: output filename

# Examples

``` julia
julia> x = range( -1000.0, stop = 1000.0, length = 2001 );
julia> gen( x, \"./data.json\" );
julia> x = linspace( -1000, 1000, 2001 );
julia> gen( x, \"data.json\" );
```
"""
function gen( domain, filepath )
function gen( domain, name )
x = collect( domain );
s = sin.( x );
c = cos.( x );

# Store data to be written to file as a collection:
data = Dict([
("x", x),
("sine", s),
("cosine", c)
]);

# Based on the script directory, create an output filepath:
filepath = joinpath( dir, name );

# Write the data to the output filepath as JSON:
outfile = open( filepath, "w" );
write( outfile, JSON.json(data) );
write( outfile, "\n" );
Expand All @@ -58,30 +65,24 @@ dir = dirname( file );

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

# Positive medium sized values:
x = range( 0.0, stop = 256.0*pi, length = 4000 );
out = joinpath( dir, "medium_positive.json" );
gen( x, out );
gen( x, "medium_positive.json" );

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

# Positive large values:
x = range( 2.0^20*(pi/2.0), stop = 2.0^60*(pi/2.0), length = 4000 );
out = joinpath( dir, "large_positive.json" );
gen( x, out );
gen( x, "large_positive.json" );

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

# Positive huge values:
x = range( 2.0^60*(pi/2.0), stop = 2.0^1000*(pi/2.0), length = 4000 );
out = joinpath( dir, "huge_positive.json" );
gen( x, out );
gen( x, "huge_positive.json" );
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,38 @@
import JSON

"""
gen( domain, filepath )
gen( domain, name )

Generate fixture data and write to file.

# Arguments

* `domain`: domain
* `filepath::AbstractString`: filepath of the output file
* `name::AbstractString`: output filename

# Examples

``` julia
julia> x = range( -1000.0, stop = 1000.0, length = 2001 );
julia> gen( x, \"./data.json\" );
julia> x = linspace( -1000, 1000, 2001 );
julia> gen( x, \"data.json\" );
```
"""
function gen( domain, filepath )
function gen( domain, name )
x = collect( domain );
s = sind.( x );
c = cosd.( x );

# Store data to be written to file as a collection:
data = Dict([
("x", x),
("sine", s),
("cosine", c)
]);

# Based on the script directory, create an output filepath:
filepath = joinpath( dir, name );

# Write the data to the output filepath as JSON:
outfile = open( filepath, "w" );
write( outfile, JSON.json(data) );
write( outfile, "\n" );
Expand All @@ -58,30 +65,24 @@ dir = dirname( file );

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

# Positive medium sized values:
x = range( 0.0, stop = 256.0*180.0, length = 4000 );
out = joinpath( dir, "medium_positive.json" );
gen( x, out );
gen( x, "medium_positive.json" );

# Negative large values:
x = range( -2.0^20*(180.0/2.0), stop = -2.0^60*(180.0/2.0), length = 4000 );
out = joinpath( dir, "large_negative.json" );
gen( x, out );
gen( x, "large_negative.json" );

# Positive large values:
x = range( 2.0^20*(180.0/2.0), stop = 2.0^60*(180.0/2.0), length = 4000 );
out = joinpath( dir, "large_positive.json" );
gen( x, out );
gen( x, "large_positive.json" );

# Negative huge values:
x = range( -2.0^60*(180.0/2.0), stop = -2.0^1000*(180.0/2.0), length = 4000 );
out = joinpath( dir, "huge_negative.json" );
gen( x, out );
gen( x, "huge_negative.json" );

# Positive huge values:
x = range( 2.0^60*(180.0/2.0), stop = 2.0^1000*(180.0/2.0), length = 4000 );
out = joinpath( dir, "huge_positive.json" );
gen( x, out );
gen( x, "huge_positive.json" );
23 changes: 14 additions & 9 deletions lib/node_modules/@stdlib/math/base/special/sincospi/test/fixtures/julia/runner.jl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,38 @@
import JSON

"""
gen( domain, filepath )
gen( domain, name )

Generate fixture data and write to file.

# Arguments

* `domain`: domain
* `filepath::AbstractString`: filepath of the output file
* `name::AbstractString`: output filename

# Examples

``` julia
julia> x = range( -1000, stop = 1000, length = 2001 );
julia> gen( x, \"./data.json\" );
julia> x = linspace( -1000, 1000, 2001 );
julia> gen( x, \"data.json\" );
```
"""
function gen( domain, filepath )
function gen( domain, name )
x = collect( domain );
s = sinpi.( x );
c = cospi.( x );

# Store data to be written to file as a collection:
data = Dict([
("x", x),
("sin", s),
("cos", c)
]);

# Based on the script directory, create an output filepath:
filepath = joinpath( dir, name );

# Write the data to the output filepath as JSON:
outfile = open( filepath, "w" );
write( outfile, JSON.json(data) );
write( outfile, "\n" );
Expand All @@ -58,10 +65,8 @@ dir = dirname( file );

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

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