Changeset 9910 in project
 Timestamp:
 03/20/08 17:34:27 (11 years ago)
 Location:
 release/3/arraylib/trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

release/3/arraylib/trunk/arraylibequal.scm
r6087 r9910 8 8 ;;  Data of extendedprocedure, taggedpointer, etc., not followed with 9 9 ;; rebound equal? procedure. 10 11 (use lolevel srfi4 srfi69)12 (use vectorlib)13 (use arraylib arraylibsem)14 10 15 11 (evalwhen (compile) … … 23 19 (export 24 20 equal?) ) ) 21 22 (use lolevel srfi4 srfi69 23 vectorlib 24 arraylib arraylibsem) 25 25 26 26 ;;; 
release/3/arraylib/trunk/tests/arraylibtest.scm
r9544 r9910 18 18 # 19 19 20 (defineforsyntax test::timing #f)21 22 20 (defineexpectbinary arrayequal?) 23 21 … … 26 24 (definetest arrayshapetest "Array Shape" 27 25 (initial 28 (define shpobj #f) 29 ) 26 (define shpobj) ) 30 27 31 28 (expectset! shpobj (makearrayshape 1 3 0 1 1 4)) … … 54 51 (definetest arraydimensionstest "Array Dimensions" 55 52 (initial 56 (define dimsobj #f) 57 (define shpobj #f) 58 ) 53 (define dimsob) 54 (define shpobj) ) 59 55 60 56 (expectset! dimsobj (makearraydimensions 2 1 3)) … … 194 190 ) 195 191 196 (test/case "O Dimension" (warn "0 Dimensions unsupported  Test WILL Fail") (192 (test/case "O Dimension" (warn "0 Dimensions Unsupported  Test WILL Fail") ( 197 193 [arr1 (makearray '#(#f) 2 0 3)] 198 194 [arr2 (makearray '#(#f) 0 2 3)] … … 233 229 (expecttrue (arrayref arr3 1 2 0)) 234 230 235 (expectequal (array '(2 1 3) 1 2 3 4 5 6) 236 (array (makearrayshape 0 2 0 0 0 3) 1 2 3 4 5 6)) 231 (expectequal 232 (array '(2 1 3) 1 2 3 4 5 6) 233 (array (makearrayshape 0 2 0 0 0 3) 1 2 3 4 5 6)) 237 234 ) 238 235 … … 316 313 317 314 (definetest arraysrfi58test "SRFI 58" 318 (expecttrue (array? '#2A:fixN16b((0 1 2) (3 5 4)))) 315 316 ; Note mixture of w/ & w/o whitespace btwn spec & value 317 318 (expecttrue (array? '#2A:fixN16b ((0 1 2) (3 5 4)))) 319 319 (expecttrue (array? '#2A2*3:fixN16b((0 1 2) (3 5 4)))) 320 (expecttrue (array? '#A2*3:fixN16b ((0 1 2) (3 5 4))))320 (expecttrue (array? '#A2*3:fixN16b ((0 1 2) (3 5 4)))) 321 321 (expecttrue (array? '#0a sym)) 322 322 (expecttrue (array? '#0A:floR32b 237.0)) 323 323 (expecttrue (array? '#A0*2())) 324 (expecttrue (array? '#A2*0 (() ())))324 (expecttrue (array? '#A2*0 (() ()))) 325 325 (expecttrue (array? '#A2*0*3(() ()))) 326 (expecttrue (array? '#A2*3*0 ((() () ()) (() () ()))))326 (expecttrue (array? '#A2*3*0 ((() () ()) (() () ())))) 327 327 ) 328 328 … … 331 331 (definetest arrayexamplestest "Examples" 332 332 (initial 333 (define fred #f)334 (define fredsdiagonal #f)335 (define fredscenter #f)336 (define fredslarge #f)337 (define arr1 #f)338 (define arr2 #f) )333 (define fred) 334 (define fredsdiagonal) 335 (define fredscenter) 336 (define fredslarge) 337 (define arr1) 338 (define arr2) ) 339 339 340 340 (expectequal '(3 5) (arraydimensions (makearray '#() 3 5))) … … 374 374 375 375 (expectfailure 376 (makesharedarray fred (lambda (i j) (list (+ 3 i) (+ 3 j))) '(2 0) '(35 37))) 376 (makesharedarray fred 377 (lambda (i j) (list (+ 3 i) (+ 3 j))) 378 '(2 0) '(35 37))) 377 379 378 380 (expectset! fredscenter 379 380 381 381 (makesharedarray fred 382 (lambda (i j) (list (+ (+ i 2) 3) (+ ( j 35) 3))) 383 '(2 0) '(35 37))) 382 384 (expecteq 'foo (arrayref fredscenter 2 35)) 383 385 384 386 ; This "works" but unsure what it means 385 387 ; Should it be legal? 386 (expectset! fredslarge 387 (makesharedarray fred 388 (lambda (i j k) (list (+ (+ i 2) 3) (+ (+ j 37) 3))) 389 '(2 0) '(37 35) '(45 456))) 388 (expectset! 389 fredslarge 390 (makesharedarray fred 391 (lambda (i j k) (list (+ (+ i 2) 3) (+ (+ j 37) 3))) 392 '(2 0) '(37 35) '(45 456))) 390 393 (expecteq 'foo (arrayref fredslarge 2 37 100)) 391 394 (expectfailure (arrayref fredslarge 2 37 1000)) … … 401 404 (expecteq 'h2 (arrayref arr2 10 4)) 402 405 403 (expectarrayequal " not strict array copy" '#(1 2) (arraycopy '#(1 2)))404 (expectarrayequal " shape & array copy" '#(1 2) (arraycopy #t '#(1 2)))406 (expectarrayequal "Not strict array copy" '#(1 2) (arraycopy '#(1 2))) 407 (expectarrayequal "Shape & array copy" '#(1 2) (arraycopy #t '#(1 2))) 405 408 ) 406 409 … … 409 412 (definetest arraybigtest "Big Array" 410 413 (initial 411 (define arr (makearray 412 '(4 1) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3))) ) 414 (define arr (makearray '(4 1) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3) '(0 3))) ) 413 415 414 416 (expectequal '(4 1 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3 0 3) (arrayshape arr)) … … 451 453 ; Uses srfi10 reader 452 454 (expectarrayequal 453 '#,(array vector ((0 . 4)) (1 2 2 4 13)) (centereddifference '#(0 1 3 5 9 22))) 455 '#,(array vector ((0 . 4)) (1 2 2 4 13)) 456 (centereddifference '#(0 1 3 5 9 22))) 454 457 ) 455 458 … … 506 509 (expectequal arr0 (apply arrayjoin arr0 '(2 1) (arraysplit/shared arr0 2))) 507 510 508 (expectarrayequal arr0 509 (apply arrayjoin arr0 (makearrayshape 3 1) (arraysplit/shared arr0 1))) 510 (expectarrayequal arr0 511 (apply arrayjoin arr0 (makearrayshape 0 2 45 46) (arraysplit/shared arr0 2))) 511 (expectarrayequal 512 arr0 513 (apply arrayjoin arr0 (makearrayshape 3 1) (arraysplit/shared arr0 1))) 514 515 (expectarrayequal 516 arr0 517 (apply arrayjoin arr0 (makearrayshape 0 2 45 46) (arraysplit/shared arr0 2))) 512 518 ) 513 519 ) … … 528 534 529 535 (expectsuccess 530 (arrayforeachindex 531 (lambda (idxs0 idxs1) 532 (assert (and (= 3 (length idxs0)) (= (length idxs0) (length idxs1))))) arr0 arr1)) 536 (arrayforeachindex 537 (lambda (idxs0 idxs1) 538 (assert (and (= 3 (length idxs0)) (= (length idxs0) (length idxs1)))) ) 539 arr0 arr1)) 533 540 534 541 (expectsuccess 535 (arrayforeachindex (lambda (i j k) (set! idxslst (cons (list i j k) idxslst))) arr0)) 542 (arrayforeachindex 543 (lambda (i j k) 544 (set! idxslst (cons (list i j k) idxslst)) ) 545 arr0)) 536 546 (expectequal '((1 0 2) (1 0 1) (1 0 0) (0 0 2) (0 0 1) (0 0 0)) idxslst) 537 547 … … 546 556 547 557 (expectarrayequal "arraysplit & rank0 bug" 548 549 558 (array '(4) 23 2 82 7) 559 (arrayreverse (array '(4) 7 82 2 23))) 550 560 551 561 ; Note use of #<n>A readsyntax 552 562 553 563 (expectarrayequal '#1A(6 15) 554 555 556 557 558 559 564 (arrayreshape arr0 1 565 (lambda (tv fv) 566 (assert (and (= 1 (vectorlength tv)) (= 3 (vectorlength fv)))) 567 (vectorset! tv 0 (apply + (vector>list fv))) 568 tv) 569 arr0)) 560 570 561 571 (expectarrayequal arr3 562 563 564 565 566 567 568 569 572 (arrayreshape '#() (makearraydimensions 2 1 3) 573 (lambda (tv fv) 574 (assert (and (= 3 (vectorlength tv)) (= 1 (vectorlength fv)))) 575 (vectorset! tv 0 #t) 576 (vectorset! tv 1 #t) 577 (vectorset! tv 2 (vectorref fv 0)) 578 tv) 579 '#1A(6 15))) 570 580 571 581 (expectarrayequal arr4 (arrayindexmap! arr0 (lambda idxs idxs))) … … 577 587 578 588 (expectset! arr5 579 580 581 582 589 (arrayunfold (A:fixN8b) '(2 1 3) 590 (lambda (i s1 s2 s3) 591 (values (random s1) (random s2) (random s3))) 592 128 128 128)) 583 593 ) 584 594 ) … … 615 625 616 626 (expectarrayequal arr0 (arrayec '#() '(2 3) (:range i 6) i)) 617 (expectequal '((0 0 0) (1 0 1) (2 0 2) (3 1 0) (4 1 1) (5 1 2)) 618 (listec (:array v (index i1 i2) arr0) (list v i1 i2))) 627 (expectequal 628 '((0 0 0) (1 0 1) (2 0 2) (3 1 0) (4 1 1) (5 1 2)) 629 (listec (:array v (index i1 i2) arr0) (list v i1 i2))) 619 630 (expectfailure 620 631 (listec (:array v (index i1 i2) 'notanarray) (list v i1 i2))) 621 632 ) 622 633 )
Note: See TracChangeset
for help on using the changeset viewer.