Testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pong.functional | |
sealed trait Event | |
sealed trait Action | |
object Action { | |
case object MoveUp extends Action | |
case object MoveDown extends Action | |
case object ShootMissile extends Action | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pong.imperative | |
sealed trait Event | |
class PongConnection { | |
def isConnected(): Boolean = sys.error("not implemented") | |
def readEvent(): Event = sys.error("not implemented") | |
def moveUp(): Unit = sys.error("not implemented") | |
def moveDown(): Unit = sys.error("not implemented") | |
def shootMissile(): Unit = sys.error("not implemented") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Cobertura - http://cobertura.sourceforge.net/ | |
* | |
* Copyright (C) 2003 jcoverage ltd. | |
* Copyright (C) 2005 Mark Doliner | |
* Copyright (C) 2005 Jeremy Thomerson | |
* Copyright (C) 2006 Jiri Mares | |
* Copyright (C) 2008 Julian Gamble | |
* | |
* Cobertura is free software; you can redistribute it and/or modify |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] Running vectortest.VectorSpeedTest | |
Result: Pos2d(12300003.00, 45600002.00) [0.224s] For Vec2d: Simplest | |
Result: Pos2d(12300003.00, 45600002.00) [0.437s] For Vec2dNumeric: Parameterized numeric type | |
Result: Pos2d(12300003.00, 45600002.00) [2.858s] For GenVec2d: Generalized size (specialized implementation for 2D) | |
Result: Pos2d(12300003.00, 45600002.00) [7.516s] For GenVec: Generalized size (parameterized) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package vectortest | |
// ------------------------------------------------------------- | |
// Simplest possible implementation, no parameterization | |
// ------------------------------------------------------------- | |
class Pos2d(val x: Double, val y: Double) { | |
def +(that: Vec2d): Pos2d = { | |
Pos2d(x + that.x, y + that.y) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function importModule(target, module) { | |
for (var method in module) | |
target[method] = module[method] | |
} | |
BASE = (function() { | |
var exports = { | |
getFoo: function() { return 'foo' } | |
} | |
return exports |