"Fossies" - the Fresh Open Source Software Archive

Member "scala-js-1.3.1/test-suite/js/src/test/scala/org/scalajs/testsuite/typedarray/ArrayBufferTest.scala" (14 Nov 2020, 972 Bytes) of package /linux/www/scala-js-1.3.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Scala source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * Scala.js (https://www.scala-js.org/)
    3  *
    4  * Copyright EPFL.
    5  *
    6  * Licensed under Apache License 2.0
    7  * (https://www.apache.org/licenses/LICENSE-2.0).
    8  *
    9  * See the NOTICE file distributed with this work for
   10  * additional information regarding copyright ownership.
   11  */
   12 
   13 package org.scalajs.testsuite.typedarray
   14 
   15 import org.junit.Assert._
   16 import org.junit.Test
   17 
   18 import org.scalajs.testsuite.utils.Requires
   19 
   20 import scala.scalajs.js.typedarray._
   21 
   22 object ArrayBufferTest extends Requires.TypedArray
   23 
   24 class ArrayBufferTest {
   25 
   26   @Test def lengthConstructor(): Unit = {
   27     val x = new ArrayBuffer(100)
   28     assertTrue(x.isInstanceOf[ArrayBuffer])
   29     assertEquals(100, x.byteLength)
   30   }
   31 
   32   @Test def slice_with_one_arg(): Unit = {
   33     val x = new ArrayBuffer(100)
   34     val y = x.slice(10)
   35     assertEquals(90, y.byteLength)
   36 
   37   }
   38 
   39   @Test def slice_with_two_args(): Unit = {
   40     val x = new ArrayBuffer(100)
   41     val y = x.slice(10, 20)
   42     assertEquals(10, y.byteLength)
   43   }
   44 }