alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (Unrolled.scala)

This example Scala source code file (Unrolled.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

list, list, properties, properties, test, test, unrolledbuffer, unrolledbuffer

The Scala Unrolled.scala source code

import org.scalacheck._
import Prop._
import Gen._

import collection.mutable.UnrolledBuffer

object Test extends Properties("UnrolledBuffer") {
  
  property("concat size") = forAll { (l1: List[Int], l2: List[Int]) =>
    val u1 = new UnrolledBuffer[Int]
    u1 ++= l1
    val u2 = new UnrolledBuffer[Int]
    u2 ++= l2
    val totalsz = u1.size + u2.size
    u1 concat u2
    totalsz == u1.size
  }
  
  property("adding") = forAll { (l: List[Int]) =>
    val u = new UnrolledBuffer[Int]
    u ++= l
    u == l
  }
  
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala Unrolled.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.