1
1
import GLSL from '../index.js'
2
2
import test from 'tape'
3
3
import evaluate from './util/eval.js'
4
- import clean from 'cln '
4
+ import clean from './util/clean.js '
5
5
6
6
7
7
var compile = GLSL ( { } )
@@ -106,7 +106,7 @@ test('float(uint)', function (t) {
106
106
107
107
// converts a Boolean value to a float
108
108
test ( 'float(bool)' , function ( t ) {
109
- t . equal ( evaluate ( '+float(true);' , { debug : false } ) , 1 ) ;
109
+ t . equal ( evaluate ( '+float(true);' , { debug : false } ) , 1 ) ;
110
110
t . equal ( evaluate ( '+float(false);' ) , 0 ) ;
111
111
t . end ( )
112
112
} )
@@ -143,7 +143,7 @@ test('double(float)', function (t) {
143
143
} )
144
144
145
145
146
- test ( 'should allow valid int initializations' , function ( t ) {
146
+ test ( 'should allow valid int initializations' , function ( t ) {
147
147
t . equal (
148
148
clean ( compile ( 'void main() { int test = 1; }' ) ) ,
149
149
clean ( 'function main () {\nvar test = 1;\n};' ) ) ;
@@ -162,7 +162,7 @@ test('should allow valid int initializations', function(t) {
162
162
t . end ( )
163
163
} )
164
164
165
- test ( 'should allow valid float initializations' , function ( t ) {
165
+ test ( 'should allow valid float initializations' , function ( t ) {
166
166
t . equal (
167
167
clean ( compile ( 'void main() { float test = 1.0; }' ) ) ,
168
168
clean ( 'function main () {\nvar test = 1.0;\n};' ) ) ;
@@ -193,7 +193,7 @@ test('should allow valid float initializations', function(t) {
193
193
t . end ( )
194
194
} )
195
195
196
- test ( 'should allow valid bool initializations' , function ( t ) {
196
+ test ( 'should allow valid bool initializations' , function ( t ) {
197
197
t . equal (
198
198
clean ( compile ( 'void main() { bool test = true; }' ) ) ,
199
199
clean ( 'function main () {\nvar test = true;\n};' ) ) ;
@@ -206,50 +206,50 @@ test('should allow valid bool initializations', function(t) {
206
206
t . end ( )
207
207
} )
208
208
209
- test . skip ( 'should throw on invalid int initializations' , function ( t ) {
210
- t . throws ( 'void main() { int test = 1.0; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
211
- t . throws ( 'void main() { int test = .04; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
212
- t . throws ( 'void main() { int test = 0.50; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
213
- t . throws ( 'void main() { int test = 55.23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
214
- t . throws ( 'void main() { int test = 5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
215
- t . throws ( 'void main() { int test = 5.5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
209
+ test . skip ( 'should throw on invalid int initializations' , function ( t ) {
210
+ t . throws ( 'void main() { int test = 1.0; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
211
+ t . throws ( 'void main() { int test = .04; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
212
+ t . throws ( 'void main() { int test = 0.50; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
213
+ t . throws ( 'void main() { int test = 55.23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
214
+ t . throws ( 'void main() { int test = 5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
215
+ t . throws ( 'void main() { int test = 5.5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
216
216
t . throws ( 'void main() { int test = 5.5e-3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
217
- t . throws ( 'void main() { int test = .5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
218
- t . throws ( 'void main() { int test = true; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
219
- t . throws ( 'void main() { int test = false; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
217
+ t . throws ( 'void main() { int test = .5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
218
+ t . throws ( 'void main() { int test = true; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
219
+ t . throws ( 'void main() { int test = false; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
220
220
t . end ( )
221
221
} )
222
222
223
223
224
- test . skip ( 'should throw on invalid float initializations' , function ( t ) {
225
- t . throws ( 'void main() { float test = 1; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
226
- t . throws ( 'void main() { float test = 55; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
227
- t . throws ( 'void main() { float test = 0x23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
228
- t . throws ( 'void main() { float test = 023; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
229
- t . throws ( 'void main() { float test = true; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
224
+ test . skip ( 'should throw on invalid float initializations' , function ( t ) {
225
+ t . throws ( 'void main() { float test = 1; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
226
+ t . throws ( 'void main() { float test = 55; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
227
+ t . throws ( 'void main() { float test = 0x23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
228
+ t . throws ( 'void main() { float test = 023; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
229
+ t . throws ( 'void main() { float test = true; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
230
230
t . throws ( 'void main() { float test = false; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
231
231
t . end ( )
232
232
} )
233
233
234
- test . skip ( 'should throw on invalid bool initializations' , function ( t ) {
235
- t . throws ( 'void main() { bool test = 1; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
236
- t . throws ( 'void main() { bool test = 55; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
237
- t . throws ( 'void main() { bool test = 0x23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
238
- t . throws ( 'void main() { bool test = 023; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
239
- t . throws ( 'void main() { bool test = 1.0; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
240
- t . throws ( 'void main() { bool test = .04; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
241
- t . throws ( 'void main() { bool test = 0.50; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
242
- t . throws ( 'void main() { bool test = 55.23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
243
- t . throws ( 'void main() { bool test = 5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
244
- t . throws ( 'void main() { bool test = 5.5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
234
+ test . skip ( 'should throw on invalid bool initializations' , function ( t ) {
235
+ t . throws ( 'void main() { bool test = 1; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
236
+ t . throws ( 'void main() { bool test = 55; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
237
+ t . throws ( 'void main() { bool test = 0x23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
238
+ t . throws ( 'void main() { bool test = 023; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
239
+ t . throws ( 'void main() { bool test = 1.0; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
240
+ t . throws ( 'void main() { bool test = .04; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
241
+ t . throws ( 'void main() { bool test = 0.50; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
242
+ t . throws ( 'void main() { bool test = 55.23; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
243
+ t . throws ( 'void main() { bool test = 5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
244
+ t . throws ( 'void main() { bool test = 5.5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
245
245
t . throws ( 'void main() { bool test = 5.5e-3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
246
- t . throws ( 'void main() { bool test = .5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
246
+ t . throws ( 'void main() { bool test = .5e3; }' , / L e f t a n d r i g h t a r g u m e n t s a r e o f d i f f e r i n g t y p e s / ) ;
247
247
t . end ( )
248
248
} )
249
249
250
250
251
251
252
- test ( 'should default ints to 0' , function ( t ) {
252
+ test ( 'should default ints to 0' , function ( t ) {
253
253
t . equal (
254
254
clean ( compile ( 'void main() { int test; }' ) ) ,
255
255
clean ( 'function main () {\nvar test = 0;\n};' ) ) ;
@@ -259,23 +259,22 @@ test('should default ints to 0', function(t) {
259
259
t . end ( )
260
260
} )
261
261
262
- test ( 'should default floats to 0.0' , function ( t ) {
262
+ test ( 'should default floats to 0.0' , function ( t ) {
263
263
t . equal (
264
264
clean ( compile ( 'void main() { float test; }' ) ) ,
265
265
clean ( 'function main () {\nvar test = 0;\n};' ) ) ;
266
266
t . equal (
267
267
clean ( compile ( 'void main() { float test, foo; }' ) ) ,
268
- clean ( 'function main () {\nvar test = 0, foo = 0;\n};' ) ) ;
268
+ clean ( 'function main () {\nvar test = 0, foo = 0;\n};' ) ) ;
269
269
t . end ( )
270
270
} )
271
271
272
- test ( 'should default bools to 0 (false)' , function ( t ) {
272
+ test ( 'should default bools to 0 (false)' , function ( t ) {
273
273
t . equal (
274
274
clean ( compile ( 'void main() { bool test; }' ) ) ,
275
275
clean ( 'function main () {\nvar test = false;\n};' ) ) ;
276
276
t . equal (
277
277
clean ( compile ( 'void main() { bool test, foo; }' ) ) ,
278
- clean ( 'function main () {\nvar test = false, foo = false;\n};' ) ) ;
278
+ clean ( 'function main () {\nvar test = false, foo = false;\n};' ) ) ;
279
279
t . end ( )
280
280
} )
281
-
0 commit comments