|
1 | 1 | /** |
2 | 2 | * @license Apache-2.0 |
3 | 3 | * |
4 | | -* Copyright (c) 2018 The Stdlib Authors. |
| 4 | +* Copyright (c) 2023 The Stdlib Authors. |
5 | 5 | * |
6 | 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | * you may not use this file except in compliance with the License. |
|
21 | 21 | // MODULES // |
22 | 22 |
|
23 | 23 | var tape = require( 'tape' ); |
24 | | -var MAX_UINT8 = require( '@stdlib/constants-uint8-max' ); |
25 | | -var bits = require( './../../dist' ); |
26 | | - |
27 | | - |
28 | | -// FIXTURES // |
29 | | - |
30 | | -var data = require( './../fixtures/julia/data.json' ); |
| 24 | +var main = require( './../../dist' ); |
31 | 25 |
|
32 | 26 |
|
33 | 27 | // TESTS // |
34 | 28 |
|
35 | | -tape( 'main export is a function', function test( t ) { |
| 29 | +tape( 'main export is defined', function test( t ) { |
36 | 30 | t.ok( true, __filename ); |
37 | | - t.strictEqual( typeof bits, 'function', 'main export is a function' ); |
38 | | - t.end(); |
39 | | -}); |
40 | | - |
41 | | -tape( 'the function returns a literal 8-bit unsigned integer representation for 0', function test( t ) { |
42 | | - var expected; |
43 | | - |
44 | | - expected = '00000000'; |
45 | | - |
46 | | - t.equal( bits(0), expected, 'returns bit literal for 0' ); |
47 | | - t.end(); |
48 | | -}); |
49 | | - |
50 | | -tape( 'the function returns a literal 8-bit unsigned integer representation for MAX_UINT8', function test( t ) { |
51 | | - var expected; |
52 | | - |
53 | | - expected = '11111111'; |
54 | | - |
55 | | - t.equal( bits(MAX_UINT8), expected, 'returns bit literal for MAX_UINT8' ); |
56 | | - t.end(); |
57 | | -}); |
58 | | - |
59 | | -tape( 'the function returns literal bit representations for unsigned 8-bit integers', function test( t ) { |
60 | | - var expected; |
61 | | - var str; |
62 | | - var x; |
63 | | - var i; |
64 | | - |
65 | | - x = data.x; |
66 | | - expected = data.expected; |
67 | | - for ( i = 0; i < x.length; i++ ) { |
68 | | - str = bits( x[ i ] ); |
69 | | - t.equal( str, expected[ i ], 'returns bit literal for ' + x[ i ] ); |
70 | | - } |
71 | | - t.end(); |
72 | | -}); |
73 | | - |
74 | | -tape( 'the function will accept floating-point values, but will interpret the values as unsigned 8-bit integers', function test( t ) { |
75 | | - var values; |
76 | | - var str; |
77 | | - var i; |
78 | | - |
79 | | - values = [ |
80 | | - 1.0e308, |
81 | | - 3.14, |
82 | | - 1.0/3.0, |
83 | | - 1.0/10.0, |
84 | | - -0.0, |
85 | | - -1.0e-308, |
86 | | - -1.0e308, |
87 | | - 1.0/0.0, |
88 | | - 1.0/-0.0, |
89 | | - NaN |
90 | | - ]; |
91 | | - |
92 | | - for ( i = 0; i < values.length; i++ ) { |
93 | | - str = bits( values[i] ); |
94 | | - t.equal( typeof str, 'string', 'returns a string' ); |
95 | | - t.equal( str.length, 8, 'returns a string of length 8' ); |
96 | | - } |
| 31 | + t.strictEqual( main !== void 0, true, 'main export is defined' ); |
97 | 32 | t.end(); |
98 | 33 | }); |
0 commit comments