mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
test kit as separate project (#178)
This commit is contained in:
parent
896cf7a228
commit
f71de81cb4
@ -93,6 +93,10 @@ lazy val model = project
|
|||||||
)
|
)
|
||||||
.dependsOn(types)
|
.dependsOn(types)
|
||||||
|
|
||||||
|
lazy val `test-kit` = project
|
||||||
|
.settings(commons: _*)
|
||||||
|
.dependsOn(model)
|
||||||
|
|
||||||
lazy val semantics = project
|
lazy val semantics = project
|
||||||
.settings(commons: _*)
|
.settings(commons: _*)
|
||||||
.settings(
|
.settings(
|
||||||
@ -101,7 +105,7 @@ lazy val semantics = project
|
|||||||
"com.github.julien-truffaut" %% "monocle-macro" % monocleV
|
"com.github.julien-truffaut" %% "monocle-macro" % monocleV
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.dependsOn(model, parser)
|
.dependsOn(model, `test-kit` % Test, parser)
|
||||||
|
|
||||||
lazy val `backend-air` = project
|
lazy val `backend-air` = project
|
||||||
.in(file("backend/air"))
|
.in(file("backend/air"))
|
||||||
|
@ -1,75 +1,51 @@
|
|||||||
package aqua.semantics
|
package aqua.semantics
|
||||||
|
|
||||||
//import aqua.AquaSpec
|
import aqua.Node
|
||||||
//import aqua.model.transform._
|
import aqua.Node._
|
||||||
//import aqua.model.{AquaContext, Node, VarModel}
|
import aqua.model.transform._
|
||||||
//import aqua.parser.Ast
|
import aqua.model.{AquaContext, LiteralModel}
|
||||||
//import aqua.parser.lift.{LiftParser, Span}
|
import aqua.parser.Ast
|
||||||
//import aqua.types.ScalarType
|
import aqua.parser.lift.{LiftParser, Span}
|
||||||
//import cats.data.Chain
|
import aqua.types.LiteralType
|
||||||
//import org.scalatest.flatspec.AnyFlatSpec
|
import org.scalatest.flatspec.AnyFlatSpec
|
||||||
//import org.scalatest.matchers.should.Matchers
|
import org.scalatest.matchers.should.Matchers
|
||||||
//
|
|
||||||
//class SemanticsSpec extends AnyFlatSpec with Matchers with AquaSpec {
|
class SemanticsSpec extends AnyFlatSpec with Matchers {
|
||||||
//
|
|
||||||
// // use it to fix https://github.com/fluencelabs/aqua/issues/90
|
// use it to fix https://github.com/fluencelabs/aqua/issues/90
|
||||||
// "sem" should "create right model" in {
|
ignore should "create right model" in {
|
||||||
// implicit val fileLift: LiftParser[Span.F] = Span.spanLiftParser
|
implicit val fileLift: LiftParser[Span.F] = Span.spanLiftParser
|
||||||
//
|
|
||||||
// val script =
|
val script =
|
||||||
// """service CustomId("cid"):
|
"""service A("srv1"):
|
||||||
// | id(s: string) -> string
|
| fn1: -> string
|
||||||
// | ids() -> string
|
|
|
||||||
// |
|
|func parFunc():
|
||||||
// |func viaArr(node_id: string, viaAr: []string) -> string:
|
| on "other-peer":
|
||||||
// | on node_id via viaAr:
|
| A.fn1()
|
||||||
// | p <- CustomId.ids()
|
| par A.fn1()""".stripMargin
|
||||||
// | <- p""".stripMargin
|
|
||||||
//
|
val ast = Ast.fromString(script).toList.head
|
||||||
// val ast = Ast.fromString(script).toList.head
|
|
||||||
//
|
val ctx = AquaContext.blank
|
||||||
// val ctx = AquaContext.blank
|
val bc = BodyConfig()
|
||||||
// val bc = BodyConfig()
|
import bc.aquaContextMonoid
|
||||||
// import bc.aquaContextMonoid
|
|
||||||
//
|
val p = Semantics.process(ast, ctx)
|
||||||
// val func = Semantics.process(ast, ctx).toList.head.funcs("viaArr")
|
|
||||||
//
|
val func = p.toList.head.funcs("parFunc")
|
||||||
// val initCallable: InitPeerCallable = InitViaRelayCallable(
|
|
||||||
// Chain.fromOption(bc.relayVarName).map(VarModel(_, ScalarType.string))
|
val proc = Node.cofToNode(func.body.tree)
|
||||||
// )
|
|
||||||
//
|
val expected =
|
||||||
// val argsProvider: ArgsProvider =
|
seq(
|
||||||
// ArgsFromService(
|
par(
|
||||||
// bc.dataSrvId,
|
on(LiteralModel("\"other-peer\"", LiteralType.string), Nil, callLiteral(1)),
|
||||||
// bc.relayVarName.map(_ -> ScalarType.string).toList ::: func.args.dataArgs.toList.map(add =>
|
callLiteral(1)
|
||||||
// add.name -> add.dataType
|
)
|
||||||
// )
|
)
|
||||||
// )
|
|
||||||
//
|
// proc.equalsOrPrintDiff(expected) should be(true)
|
||||||
// val transform =
|
|
||||||
// initCallable.transform _ compose argsProvider.transform
|
}
|
||||||
//
|
}
|
||||||
// val callback = initCallable.service(bc.callbackSrvId)
|
|
||||||
//
|
|
||||||
// val wrapFunc = ResolveFunc(
|
|
||||||
// transform,
|
|
||||||
// callback,
|
|
||||||
// bc.respFuncName
|
|
||||||
// )
|
|
||||||
//
|
|
||||||
// val tree =
|
|
||||||
// wrapFunc.resolve(func).value.tree
|
|
||||||
//
|
|
||||||
// println(Node.cofToNode(tree))
|
|
||||||
//
|
|
||||||
// // SO
|
|
||||||
//// Topology.resolve(
|
|
||||||
//// Node.cofToNode(tree)
|
|
||||||
//// )
|
|
||||||
//
|
|
||||||
// // or
|
|
||||||
//// val expected =
|
|
||||||
//// seq(par(on(LiteralModel("\"other-peer\"", LiteralType.string), Nil, callL(1)), callL(1)))
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
package aqua.model
|
package aqua
|
||||||
|
|
||||||
import aqua.model.func.Call
|
import aqua.model.func.Call
|
||||||
import aqua.model.func.body._
|
import aqua.model.func.body._
|
||||||
import aqua.model.transform.{BodyConfig, ErrorsCatcher}
|
import aqua.model.transform.{BodyConfig, ErrorsCatcher}
|
||||||
|
import aqua.model.{LiteralModel, ValueModel, VarModel}
|
||||||
import aqua.types.{ArrayType, LiteralType, ScalarType}
|
import aqua.types.{ArrayType, LiteralType, ScalarType}
|
||||||
import cats.Eval
|
import cats.Eval
|
||||||
import cats.data.Chain
|
import cats.data.Chain
|
@ -1,13 +1,13 @@
|
|||||||
package aqua.model.topology
|
package aqua.model.topology
|
||||||
|
|
||||||
import org.scalatest.flatspec.AnyFlatSpec
|
|
||||||
import org.scalatest.matchers.should.Matchers
|
|
||||||
import Location.Matchers._
|
|
||||||
import ChainZipper.Matchers._
|
|
||||||
import aqua.model.func.body.SeqTag
|
import aqua.model.func.body.SeqTag
|
||||||
|
import aqua.model.topology.ChainZipper.Matchers.`head`
|
||||||
|
import aqua.model.topology.Location.Matchers._
|
||||||
import cats.Eval
|
import cats.Eval
|
||||||
import cats.data.Chain
|
import cats.data.Chain
|
||||||
import cats.free.Cofree
|
import cats.free.Cofree
|
||||||
|
import org.scalatest.flatspec.AnyFlatSpec
|
||||||
|
import org.scalatest.matchers.should.Matchers
|
||||||
|
|
||||||
class LocationSpec extends AnyFlatSpec with Matchers {
|
class LocationSpec extends AnyFlatSpec with Matchers {
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package aqua.model.topology
|
package aqua.model.topology
|
||||||
|
|
||||||
import aqua.model.Node
|
import aqua.Node
|
||||||
import org.scalatest.flatspec.AnyFlatSpec
|
import org.scalatest.flatspec.AnyFlatSpec
|
||||||
import org.scalatest.matchers.should.Matchers
|
import org.scalatest.matchers.should.Matchers
|
||||||
|
|
@ -1,8 +1,9 @@
|
|||||||
package aqua.model.transform
|
package aqua.model.transform
|
||||||
|
|
||||||
|
import aqua.Node
|
||||||
import aqua.model.func.body.{CallArrowTag, CallServiceTag, FuncOp}
|
import aqua.model.func.body.{CallArrowTag, CallServiceTag, FuncOp}
|
||||||
import aqua.model.func.{ArgsDef, Call, FuncCallable}
|
import aqua.model.func.{ArgsDef, Call, FuncCallable}
|
||||||
import aqua.model.{LiteralModel, Node, VarModel}
|
import aqua.model.{LiteralModel, VarModel}
|
||||||
import aqua.types.ScalarType
|
import aqua.types.ScalarType
|
||||||
import org.scalatest.flatspec.AnyFlatSpec
|
import org.scalatest.flatspec.AnyFlatSpec
|
||||||
import org.scalatest.matchers.should.Matchers
|
import org.scalatest.matchers.should.Matchers
|
Loading…
Reference in New Issue
Block a user