Skip to content

Commit 1fb44b5

Browse files
committed
Auto-generated commit
1 parent 427314f commit 1fb44b5

File tree

5 files changed

+18
-137
lines changed

5 files changed

+18
-137
lines changed

.github/.keepalive

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2023-11-01T03:46:18.583Z

.github/workflows/publish.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ jobs:
182182
fi
183183
# Trim leading and trailing whitespace:
184184
dep=$(echo "$dep" | xargs)
185-
version="^$(npm view $dep version)"
185+
version="$(npm view $dep version)"
186+
if [[ -z "$version" ]]; then
187+
continue
188+
fi
189+
version="^$version"
186190
jq -r --arg dep "$dep" --arg version "$version" '.dependencies[$dep] = $version' package.json > package.json.tmp
187191
mv package.json.tmp package.json
188192
done
@@ -192,7 +196,11 @@ jobs:
192196
fi
193197
# Trim leading and trailing whitespace:
194198
dep=$(echo "$dep" | xargs)
195-
version="^$(npm view $dep version)"
199+
version="$(npm view $dep version)"
200+
if [[ -z "$version" ]]; then
201+
continue
202+
fi
203+
version="^$version"
196204
jq -r --arg dep "$dep" --arg version "$version" '.devDependencies[$dep] = $version' package.json > package.json.tmp
197205
mv package.json.tmp package.json
198206
done

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ Stephannie Jiménez Gacha <steff456@hotmail.com>
3737
Yernar Yergaziyev <yernar.yergaziyev@erg.kz>
3838
orimiles5 <97595296+orimiles5@users.noreply.github.com>
3939
rei2hu <reimu@reimu.ws>
40+
Robert Gislason <gztown2216@yahoo.com>

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ Copyright &copy; 2016-2023. The Stdlib [Authors][stdlib-authors].
206206
[npm-image]: http://img.shields.io/npm/v/@stdlib/number-float32-base-to-binary-string.svg
207207
[npm-url]: https://npmjs.org/package/@stdlib/number-float32-base-to-binary-string
208208

209-
[test-image]: https://github.com/stdlib-js/number-float32-base-to-binary-string/actions/workflows/test.yml/badge.svg?branch=v0.1.1
210-
[test-url]: https://github.com/stdlib-js/number-float32-base-to-binary-string/actions/workflows/test.yml?query=branch:v0.1.1
209+
[test-image]: https://github.com/stdlib-js/number-float32-base-to-binary-string/actions/workflows/test.yml/badge.svg?branch=main
210+
[test-url]: https://github.com/stdlib-js/number-float32-base-to-binary-string/actions/workflows/test.yml?query=branch:main
211211

212212
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/number-float32-base-to-binary-string/main.svg
213213
[coverage-url]: https://codecov.io/github/stdlib-js/number-float32-base-to-binary-string?branch=main

test/dist/test.js

Lines changed: 4 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2023 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -21,142 +21,13 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24-
var repeat = require( '@stdlib/string-repeat' );
25-
var rpad = require( '@stdlib/string-right-pad' );
26-
var PINF = require( '@stdlib/constants-float32-pinf' );
27-
var NINF = require( '@stdlib/constants-float32-ninf' );
28-
var toBinaryStringf = require( './../../dist' );
29-
30-
31-
// VARIABLES //
32-
33-
// TODO: consider placing in external modules
34-
var NUM_SIGNIFICAND_BITS = 23;
35-
var NUM_EXPONENT_BITS = 8;
36-
37-
38-
// FIXTURES //
39-
40-
var small = require( './../fixtures/julia/bits_1e-36_1e-38.json' );
41-
var medium = require( './../fixtures/julia/bits_-1e3_1e3.json' );
42-
var large = require( './../fixtures/julia/bits_1e36_1e38.json' );
43-
var subnormal = require( './../fixtures/julia/bits_1e-39_1e-45.json' );
24+
var main = require( './../../dist' );
4425

4526

4627
// TESTS //
4728

48-
tape( 'main export is a function', function test( t ) {
29+
tape( 'main export is defined', function test( t ) {
4930
t.ok( true, __filename );
50-
t.equal( typeof toBinaryStringf, 'function', 'main export is a function' );
51-
t.end();
52-
});
53-
54-
tape( 'if provided `+0`, the function returns a string of all zeros', function test( t ) {
55-
var expected = repeat( '0', 32 );
56-
t.equal( toBinaryStringf( 0.0 ), expected, 'returns all 0s' );
57-
t.end();
58-
});
59-
60-
tape( 'if provided `-0`, the function returns a string of all zeros except for the sign bit', function test( t ) {
61-
var expected = rpad( '1', 32, '0' );
62-
t.equal( toBinaryStringf( -0.0 ), expected, 'returns all 0s except the sign bit' );
63-
t.end();
64-
});
65-
66-
tape( 'if provided `+infinity`, the function returns a string where all exponent bits are 1s and everything else are 0s', function test( t ) {
67-
var expected;
68-
69-
expected = '0';
70-
expected += repeat( '1', NUM_EXPONENT_BITS );
71-
expected += repeat( '0', NUM_SIGNIFICAND_BITS );
72-
73-
t.equal( toBinaryStringf( PINF ), expected, 'returns bit string for +infinity' );
74-
t.end();
75-
});
76-
77-
tape( 'if provided `-infinity`, the function returns a string where the sign bit is 1, all exponent bits are 1s, and everything else are 0s', function test( t ) {
78-
var expected;
79-
80-
expected = '1';
81-
expected += repeat( '1', NUM_EXPONENT_BITS );
82-
expected += repeat( '0', NUM_SIGNIFICAND_BITS );
83-
84-
t.equal( toBinaryStringf( NINF ), expected, 'returns bit string for -infinity' );
85-
t.end();
86-
});
87-
88-
tape( 'if provided `NaN`, the function returns a string where the sign bit may be either 1 or 0, all exponent bits are 1s, and the fraction cannot be all 0s', function test( t ) {
89-
var actual;
90-
var frac;
91-
var exp;
92-
93-
exp = repeat( '1', NUM_EXPONENT_BITS );
94-
frac = repeat( '0', NUM_SIGNIFICAND_BITS );
95-
96-
actual = toBinaryStringf( NaN );
97-
98-
t.ok( actual[0] === '0' || actual[1] === '1', 'sign bit is either 1 or 0' );
99-
t.equal( actual.substring( 1, 9 ), exp, 'all 1s for exponent' );
100-
t.notEqual( actual.substring( 9 ), frac, 'fraction does not equal all 0s' );
101-
t.end();
102-
});
103-
104-
tape( 'the function returns literal bit representations for small values', function test( t ) {
105-
var expected;
106-
var str;
107-
var x;
108-
var i;
109-
110-
x = small.x;
111-
expected = small.expected;
112-
for ( i = 0; i < x.length; i++ ) {
113-
str = toBinaryStringf( x[ i ] );
114-
t.equal( str, expected[ i ], 'returns bit literal for ' + x[ i ] );
115-
}
116-
t.end();
117-
});
118-
119-
tape( 'the function returns literal bit representations for medium values', function test( t ) {
120-
var expected;
121-
var str;
122-
var x;
123-
var i;
124-
125-
x = medium.x;
126-
expected = medium.expected;
127-
for ( i = 0; i < x.length; i++ ) {
128-
str = toBinaryStringf( x[ i ] );
129-
t.equal( str, expected[ i ], 'returns bit literal for ' + x[ i ] );
130-
}
131-
t.end();
132-
});
133-
134-
tape( 'the function returns literal bit representations for large values', function test( t ) {
135-
var expected;
136-
var str;
137-
var x;
138-
var i;
139-
140-
x = large.x;
141-
expected = large.expected;
142-
for ( i = 0; i < x.length; i++ ) {
143-
str = toBinaryStringf( x[ i ] );
144-
t.equal( str, expected[ i ], 'returns bit literal for ' + x[ i ] );
145-
}
146-
t.end();
147-
});
148-
149-
tape( 'the function returns literal bit representations for subnormal values', function test( t ) {
150-
var expected;
151-
var str;
152-
var x;
153-
var i;
154-
155-
x = subnormal.x;
156-
expected = subnormal.expected;
157-
for ( i = 0; i < x.length; i++ ) {
158-
str = toBinaryStringf( x[ i ] );
159-
t.equal( str, expected[ i ], 'returns bit literal for ' + x[ i ] );
160-
}
31+
t.strictEqual( main !== void 0, true, 'main export is defined' );
16132
t.end();
16233
});

0 commit comments

Comments
 (0)