;; -*-theme-d-*-

;; Copyright (C) 2017  Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.

;; Expected results: translation and running OK
;; Expected output: #t #t #f #t #t #t #t #t


(define-proper-program (tests test562)


  (import (standard-library core)
	  (standard-library console-io))


  (define-prim-class <bytevector>
    #f #t #t ()
    bytevector? bytevector=? eqv? bytevector=?)


  (define make-bytevector
    (prim-proc make-bytevector (<integer> <integer>) <bytevector> (pure)))


  (define bytevector-length
    (prim-proc bytevector-length (<bytevector>) <integer> (pure)))


  (define bytevector-u8-ref
    (prim-proc bytevector-u8-ref (<bytevector> <integer>) <integer> (pure)))


  (define bytevector-u8-set!
    (prim-proc bytevector-u8-set! (<bytevector> <integer> <integer>) <none>
	       (nonpure)))


  (define main
    (lambda (() <none> nonpure)
      (let ((bv1 (make-bytevector 10 128))
	    (bv2 (make-bytevector 10 128)))
	(bytevector-u8-set! bv1 5 20)
	(bytevector-u8-set! bv2 5 20)
	(console-display-line (equal? bv1 bv2))
	(console-display-line (equal-values? bv1 bv2))
	(console-display-line (equal-objects? bv1 bv2))
	(console-display-line (equal-contents? bv1 bv2))
	(console-display-line (equal? bv1 bv1))
	(console-display-line (equal-values? bv1 bv1))
	(console-display-line (equal-objects? bv1 bv1))
	(console-display-line (equal-contents? bv1 bv1))))))

