Skip to content

Commit

Permalink
fix: testing
Browse files Browse the repository at this point in the history
  • Loading branch information
eruizalo committed Aug 15, 2023
1 parent ac5a787 commit 0b8b50e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
10 changes: 0 additions & 10 deletions core/src/test/scala/doric/syntax/NumericOperationsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -546,16 +546,6 @@ trait NumericOperationsSpec
)
}

it(s"round function with scale and round mode") {
val scale = 2
val mode = BigDecimal.RoundingMode.FLOOR
testOnlyDoricDecimals[T, T](
List(Some(1.466666f), Some(0.7111111f), Some(1.0f), None),
List(Some(1.46f), Some(0.71f), Some(1.0f), None),
_.round(scale.lit, mode)
)
}

it(s"naNvl function with param") {
testDoricSparkDecimals2[T, T, T](
List(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package doric
package syntax

import doric.Equalities._
import doric.types.SparkType.Primitive
import org.apache.spark.sql.SparkSession
import org.scalactic.Equality
import org.scalatest.funspec.AnyFunSpecLike

import scala.reflect.ClassTag

trait NumericOperations32Spec
extends AnyFunSpecLike
with TypedColumnTest
with NumericUtilsSpec {

import scala.reflect.runtime.universe._

def testDecimals32[
T: NumWithDecimalsType : Primitive : ClassTag : TypeTag : Equality
]()(implicit
spark: SparkSession,
fun: FromFloat[T]
): Unit = {
val numTypeStr = getClassName[T]

describe(s"Num with Decimals ( $numTypeStr )") {

it(s"round function with scale and round mode") {
val scale = 2
val mode = BigDecimal.RoundingMode.FLOOR
testOnlyDoricDecimals[T, T](
List(Some(1.466666f), Some(0.7111111f), Some(1.0f), None),
List(Some(1.46f), Some(0.71f), Some(1.0f), None),
_.round(scale.lit, mode)
)
}
}
}
}

class Numeric32Spec extends NumericOperations32Spec with SparkSessionTestWrapper {

implicit val sparkSession: SparkSession = spark

testDecimals32[Float]()
testDecimals32[Double]()
}

0 comments on commit 0b8b50e

Please sign in to comment.