File tree 2 files changed +11
-3
lines changed
main/scala/optimus/algebra
test/scala/optimus/algebra
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 11
11
* \///// \/// \///// \/// \/// \/// \/// \///////// \//////////
12
12
*
13
13
* The mathematical programming library for Scala.
14
- *
14
+ *
15
15
*/
16
16
17
17
package optimus .algebra
@@ -235,7 +235,7 @@ case object Zero extends Const(0) {
235
235
236
236
case object One extends Const (1 ) {
237
237
238
- override def * (expression : Expression ): Expression = this
238
+ override def * (expression : Expression ): Expression = expression
239
239
240
240
override def unary_- : Const = Const (- 1 )
241
241
}
Original file line number Diff line number Diff line change 11
11
* \///// \/// \///// \/// \/// \/// \/// \///////// \//////////
12
12
*
13
13
* The mathematical programming library for Scala.
14
- *
14
+ *
15
15
*/
16
16
17
17
package optimus .algebra
@@ -326,4 +326,12 @@ final class AlgebraSpecTest extends AnyFunSpec with Matchers {
326
326
constraint_1.equals(constraint_2) shouldEqual false
327
327
}
328
328
}
329
+
330
+ describe(" Limit cases" ) {
331
+ def multiply (ex : Expression , d : Double ): Expression = ex * d
332
+
333
+ it(" 1 * c should be equal to c (and not to 1)" ) {
334
+ multiply(One , 10.0 ) shouldBe Const (10.0 )
335
+ }
336
+ }
329
337
}
You can’t perform that action at this time.
0 commit comments