Commit dca218cd authored by Ask Hjorth Larsen's avatar Ask Hjorth Larsen
Browse files

start writing tests. Shamelessly copy framework from Octopus parser

parent e7fd2752
package eu.nomad_lab.parsers
import eu.{ nomad_lab => lab }
import eu.nomad_lab.DefaultPythonInterpreter
import org.{ json4s => jn }
import scala.collection.breakOut
object SiestaParser extends SimpleExternalParserGenerator(
name = "SiestaParser",
parserInfo = jn.JObject(
("name" -> jn.JString("SiestaParser")) ::
("parserId" -> jn.JString("SiestaParser" + lab.SiestaVersionInfo.version)) ::
("versionInfo" -> jn.JObject(
("nomadCoreVersion" -> jn.JObject(lab.NomadCoreVersionInfo.toMap.map {
case (k, v) => k -> jn.JString(v.toString)
}(breakOut): List[(String, jn.JString)])) ::
(lab.SiestaVersionInfo.toMap.map {
case (key, value) =>
(key -> jn.JString(value.toString))
}(breakOut): List[(String, jn.JString)])
)) :: Nil
),
mainFileTypes = Seq("text/.*"),
//TODO: Update the replacement string (mainFileRe)
mainFileRe = """\*{32} Grid \*{32}
Simulation Box:
""".r,
cmd = Seq(DefaultPythonInterpreter.pythonExe(), "${envDir}/parsers/siesta/parser/parser-siesta/parser_siesta.py",
"${mainFilePath}"),
resList = Seq(
"parser-siesta/parser.py",
"parser-siesta/util.py",
"parser-siesta/setup_paths.py",
"nomad_meta_info/public.nomadmetainfo.json",
"nomad_meta_info/common.nomadmetainfo.json",
"nomad_meta_info/meta_types.nomadmetainfo.json",
"nomad_meta_info/siesta.autogenerated.nomadmetainfo.json",
"nomad_meta_info/siesta.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
"parser-siesta" -> "parsers/siesta/parser/parser-siesta",
"nomad_meta_info" -> "nomad-meta-info/meta_info/nomad_meta_info"
) ++ DefaultPythonInterpreter.commonDirMapping()
)
package eu.nomad_lab.parsers
import org.specs2.mutable.Specification
object SiestaParserSpec extends Specification {
"SiestaParserTest" >> {
"test with json-events" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O/out", "json-events") must_== ParseResult.ParseSuccess
}
"test with json" >> {
ParserRun.parse(SiestaParser, "parsers/siesta/test/examples/H2O/out", "json") must_== ParseResult.ParseSuccess
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment