new tester; all tests categorized

This commit is contained in:
Araq 2014-01-13 02:10:03 +01:00
commit 20b5f31c03
481 changed files with 794 additions and 2506 deletions

67
tests/ccgbugs/tccgen1.nim Normal file
View file

@ -0,0 +1,67 @@
type
Feature = tuple[name: string, version: string]
PDOMImplementation* = ref DOMImplementation
DOMImplementation = object
Features: seq[Feature] # Read-Only
PNode* = ref Node
Node = object {.inheritable.}
attributes*: seq[PAttr]
childNodes*: seq[PNode]
FLocalName: string # Read-only
FNamespaceURI: string # Read-only
FNodeName: string # Read-only
nodeValue*: string
FNodeType: int # Read-only
FOwnerDocument: PDocument # Read-Only
FParentNode: PNode # Read-Only
prefix*: string # Setting this should change some values... TODO!
PElement* = ref Element
Element = object of Node
FTagName: string # Read-only
PCharacterData = ref CharacterData
CharacterData = object of Node
data*: string
PDocument* = ref Document
Document = object of Node
FImplementation: PDOMImplementation # Read-only
FDocumentElement: PElement # Read-only
PAttr* = ref Attr
Attr = object of Node
FName: string # Read-only
FSpecified: bool # Read-only
value*: string
FOwnerElement: PElement # Read-only
PDocumentFragment* = ref DocumentFragment
DocumentFragment = object of Node
PText* = ref Text
Text = object of CharacterData
PComment* = ref comment
Comment = object of CharacterData
PCDataSection* = ref CDataSection
CDataSection = object of Text
PProcessingInstruction* = ref ProcessingInstruction
ProcessingInstruction = object of Node
data*: string
FTarget: string # Read-only
proc `namespaceURI=`*(n: var PNode, value: string) =
n.FNamespaceURI = value
proc main =
var n: PNode
new(n)
n.namespaceURI = "test"
main()

23
tests/ccgbugs/tcgbug.nim Normal file
View file

@ -0,0 +1,23 @@
discard """
file: "tcgbug.nim"
output: "success"
"""
type
TObj = object
x, y: int
PObj = ref TObj
proc p(a: PObj) =
a.x = 0
proc q(a: var PObj) =
a.p()
var
a: PObj
new(a)
q(a)
echo "success"

View file

@ -0,0 +1,67 @@
import os
type
TStatusEnum* = enum
sUnknown = -1, sBuildFailure, sBuildInProgress, sBuildSuccess,
sTestFailure, sTestInProgress, sTestSuccess, # ORDER MATTERS!
sDocGenFailure, sDocGenInProgress, sDocGenSuccess,
sCSrcGenFailure, sCSrcGenInProgress, sCSrcGenSuccess
TStatus* = object
status*: TStatusEnum
desc*: string
hash*: string
proc initStatus*(): TStatus =
result.status = sUnknown
result.desc = ""
result.hash = ""
proc isInProgress*(status: TStatusEnum): bool =
return status in {sBuildInProgress, sTestInProgress, sDocGenInProgress,
sCSrcGenInProgress}
proc `$`*(status: TStatusEnum): string =
case status
of sBuildFailure:
return "build failure"
of sBuildInProgress:
return "build in progress"
of sBuildSuccess:
return "build finished"
of sTestFailure:
return "testing failure"
of sTestInProgress:
return "testing in progress"
of sTestSuccess:
return "testing finished"
of sDocGenFailure:
return "documentation generation failed"
of sDocGenInProgress:
return "generating documentation"
of sDocGenSuccess:
return "documentation generation succeeded"
of sCSrcGenFailure:
return "csource generation failed"
of sCSrcGenInProgress:
return "csource generation in progress"
of sCSrcGenSuccess:
return "csource generation succeeded"
of sUnknown:
return "unknown"
proc makeCommitPath*(platform, hash: string): string =
return platform / "nimrod_" & hash.substr(0, 11) # 11 Chars.
type
TFlag = enum
A, B, C, D
TFlags = set[TFlag]
TObj = object
x: int
flags: TFlags
# have a proc taking TFlags as param and returning object having TFlags field
proc foo(flags: TFlags): TObj = nil