Implement Software Report Base Module (#6707)

* Implement first version

* fix tables rendering

* Fix scripts

* update test files

* implement calculate image diff script

* Polish code and make e2e validation

* remove test files

* render add and removed firstly
This commit is contained in:
Maxim Lobanov
2022-12-07 14:20:14 +01:00
committed by GitHub
parent 69cdead4fc
commit 6eaa5b44cf
5 changed files with 760 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
############################
### Abstract base nodes ####
############################
# Abstract base class for all nodes
class BaseNode {
[Boolean] ShouldBeIncludedToDiff() {
return $False
}
[Boolean] IsSimilarTo([BaseNode] $OtherNode) {
throw "Abtract method 'IsSimilarTo' is not implemented for '$($this.GetType().Name)'"
}
[Boolean] IsIdenticalTo([BaseNode] $OtherNode) {
throw "Abtract method 'IsIdenticalTo' is not implemented for '$($this.GetType().Name)'"
}
}
# Abstract base class for all nodes that describe a tool and should be rendered inside diff table
class BaseToolNode: BaseNode {
[String] $ToolName
BaseToolNode([String] $ToolName) {
$this.ToolName = $ToolName
}
[Boolean] ShouldBeIncludedToDiff() {
return $True
}
[String] GetValue() {
throw "Abtract method 'GetValue' is not implemented for '$($this.GetType().Name)'"
}
[Boolean] IsSimilarTo([BaseNode] $OtherNode) {
if ($this.GetType() -ne $OtherNode.GetType()) {
return $False
}
return $this.ToolName -eq $OtherNode.ToolName
}
[Boolean] IsIdenticalTo([BaseNode] $OtherNode) {
return $this.IsSimilarTo($OtherNode) -and ($this.GetValue() -eq $OtherNode.GetValue())
}
}