aboutsummaryrefslogtreecommitdiff
path: root/adapters/gtest_adapter.go
diff options
context:
space:
mode:
authorFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-03 02:02:40 -0500
committerFlu0r1ne <flur01ne@flu0r1ne.net>2021-08-03 02:02:40 -0500
commita0b020a78eb0b33965c59460fc093c6959216e44 (patch)
tree3b2722388ea6b312e927b6066b0831524ba4ed6b /adapters/gtest_adapter.go
downloadplanr-a0b020a78eb0b33965c59460fc093c6959216e44.tar.xz
planr-a0b020a78eb0b33965c59460fc093c6959216e44.zip
Initial commit with basic build structure
Diffstat (limited to 'adapters/gtest_adapter.go')
-rw-r--r--adapters/gtest_adapter.go97
1 files changed, 97 insertions, 0 deletions
diff --git a/adapters/gtest_adapter.go b/adapters/gtest_adapter.go
new file mode 100644
index 0000000..4cbaa9c
--- /dev/null
+++ b/adapters/gtest_adapter.go
@@ -0,0 +1,97 @@
+package adapters
+
+import (
+ "fmt"
+ "github.com/BurntSushi/toml"
+ "golang.flu0r1ne.net/planr"
+ "log"
+)
+
+/*
+ CONFIGURATION
+*/
+
+type GtestDefaults struct {
+ Name *string
+ Suite *string
+ File *string
+}
+
+func (child *GtestDefaults) Inherit(p interface{}) {
+ parent := p.(*GtestDefaults)
+
+ if(child.Name == nil) {
+ child.Name = parent.Name
+ }
+
+ if(child.Suite == nil) {
+ child.Suite = parent.Suite
+ }
+
+ if(child.File == nil) {
+ child.File = parent.File
+ }
+}
+
+
+type GtestConfig struct {
+ GtestDefaults
+}
+
+func primitiveDecode(primitive toml.Primitive, config interface{}) {
+ if err := toml.PrimitiveDecode(primitive, config); err != nil {
+ log.Fatal(err)
+ }
+}
+
+func ParseConfig(prim toml.Primitive) planr.InheritableConfig {
+ config := GtestConfig{}
+
+ primitiveDecode(prim, &config)
+
+ return &config
+}
+
+func ParseDefaultConfig(prim toml.Primitive) planr.InheritableConfig {
+ config := GtestDefaults{}
+
+ primitiveDecode(prim, &config)
+
+ return &config
+}
+
+/*
+ BUILD PROCESS
+*/
+
+type GtestAdapter struct {}
+
+func (a GtestAdapter) Config() planr.AdapterConfig {
+ return planr.AdapterConfig {
+ Name: "gtest",
+ ParseConfig: ParseConfig,
+ ParseDefaultConfig: ParseDefaultConfig,
+ }
+}
+
+func (a GtestAdapter) InitializeBuild() {
+ fmt.Println("Initializing");
+}
+
+func (a GtestAdapter) Build(tc planr.TestCase) {
+ fmt.Printf("Building %v\n", tc);
+}
+
+func (a GtestAdapter) FinalizeBuild() {
+ fmt.Println("Finalizing");
+}
+
+func (a GtestAdapter) Evaluate(tc planr.TestCase) planr.TestResult {
+ fmt.Printf("Evaluating %v\n", tc);
+
+ return planr.TestResult {}
+}
+
+func (a GtestAdapter) Cleanup() {
+ fmt.Printf("Cleaning\n")
+}