diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-02-04 23:45:45 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-02-04 23:45:45 +0100 |
commit | d41d9f704d8b97b7b0d90c62cde64c864b091b59 (patch) | |
tree | 48245eff42436404d3e8542d703597d2dfe58b63 | |
parent | 08ee62a783b82323046c1c64d13a527507935f36 (diff) | |
parent | 25cee6e05b197cec458653b38e78c7027d0dff78 (diff) | |
download | Nim-d41d9f704d8b97b7b0d90c62cde64c864b091b59.tar.gz |
Merge pull request #2067 from def-/tests-stuff
Tests stuff
30 files changed, 231 insertions, 168 deletions
diff --git a/lib/pure/unittest.nim b/lib/pure/unittest.nim index 8dc9fe0d4..f4e42ee63 100644 --- a/lib/pure/unittest.nim +++ b/lib/pure/unittest.nim @@ -39,6 +39,7 @@ when declared(stdout): when not defined(ECMAScript): import terminal + system.addQuitProc(resetAttributes) type TestStatus* = enum OK, FAILED @@ -234,5 +235,3 @@ if envOutLvl.len > 0: if $opt == envOutLvl: outputLevel = opt break - -system.addQuitProc(resetAttributes) diff --git a/tests/assert/tfailedassert.nim b/tests/assert/tfailedassert.nim index d03d3136b..8766321bf 100644 --- a/tests/assert/tfailedassert.nim +++ b/tests/assert/tfailedassert.nim @@ -3,7 +3,7 @@ discard """ WARNING: false first assertion from bar ERROR: false second assertion from bar -1 -tfailedassert.nim:27 false assertion from foo +tests/assert/tfailedassert.nim:27 false assertion from foo ''' """ diff --git a/tests/bind/tnicerrorforsymchoice.nim b/tests/bind/tnicerrorforsymchoice.nim index e1ff090dd..bf6d92927 100644 --- a/tests/bind/tnicerrorforsymchoice.nim +++ b/tests/bind/tnicerrorforsymchoice.nim @@ -1,6 +1,6 @@ discard """ line: 18 - errormsg: "type mismatch: got (proc (TScgi) | proc (AsyncSocket, StringTableRef, string){.gcsafe.})" + errormsg: "type mismatch: got (proc (TScgi) | proc (AsyncSocket, StringTableRef, string)" """ #bug #442 diff --git a/tests/clearmsg/ta.nim b/tests/clearmsg/ta.nim index b21522d12..38449c319 100644 --- a/tests/clearmsg/ta.nim +++ b/tests/clearmsg/ta.nim @@ -1,5 +1,5 @@ discard """ - errormsg: 'type mismatch: got (mc.typ)' + errormsg: "type mismatch: got (mc.typ)" line: 12 """ diff --git a/tests/cpp/trawsockets.nim b/tests/cpp/trawsockets.nim new file mode 100644 index 000000000..d034245d0 --- /dev/null +++ b/tests/cpp/trawsockets.nim @@ -0,0 +1,5 @@ +discard """ + cmd: "nim cpp $target" +""" + +import rawsockets diff --git a/tests/cpp/ttypeinfo.nim b/tests/cpp/ttypeinfo.nim new file mode 100644 index 000000000..e72883dbf --- /dev/null +++ b/tests/cpp/ttypeinfo.nim @@ -0,0 +1,5 @@ +discard """ + cmd: "nim cpp $target" +""" + +import typeinfo diff --git a/tests/effects/teffects1.nim b/tests/effects/teffects1.nim index 27f89f5fa..ea1ea7b21 100644 --- a/tests/effects/teffects1.nim +++ b/tests/effects/teffects1.nim @@ -1,5 +1,4 @@ discard """ - line: 2166 file: "system.nim" errormsg: "can raise an unlisted exception: ref IOError" """ diff --git a/tests/iter/tconcat.nim b/tests/iter/tconcat.nim new file mode 100644 index 000000000..477ac5e26 --- /dev/null +++ b/tests/iter/tconcat.nim @@ -0,0 +1,24 @@ +discard """ + output: '''1 +2 +3 +4 +20 +21 +22 +23''' +""" + +proc toIter*[T](s: Slice[T]): iterator: T = + iterator it: T {.closure.} = + for x in s.a..s.b: + yield x + return it + +iterator concat*[T](its: varargs[T, toIter]): auto = + for i in its: + for x in i(): + yield x + +for i in concat(1..4, 20..23): + echo i diff --git a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim index d079a2e72..08f1dad50 100644 --- a/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim +++ b/tests/manyloc/keineschweine/dependencies/chipmunk/chipmunk.nim @@ -74,7 +74,7 @@ type contacts*: PContact stamp*: TTimestamp handler*: PCollisionHandler - swappedColl*: bool32 + swappedColl*: Bool32 state*: TArbiterState PCollisionHandler* = ptr TCollisionHandler TCollisionHandler*{.pf.} = object @@ -108,7 +108,7 @@ type #/ Collision begin event function callback type. #/ Returning false from a begin callback causes the collision to be ignored until #/ the the separate callback is called when the objects stop colliding. - TCollisionBeginFunc* = proc (arb: PArbiter; space: PSpace; data: pointer): Bool{. + TCollisionBeginFunc* = proc (arb: PArbiter; space: PSpace; data: pointer): bool{. cdecl.} #/ Collision pre-solve event function callback type. #/ Returning false from a pre-step callback causes the collision to be ignored until the next step. @@ -142,14 +142,14 @@ type PSpatialIndex = ptr TSpatialIndex TSpatialIndex{.pf.} = object klass: PSpatialIndexClass - bbfunc: TSpatialIndexBBFunc + bbfun: TSpatialIndexBBFunc staticIndex: PSpatialIndex dynamicIndex: PSpatialIndex TSpatialIndexDestroyImpl* = proc (index: PSpatialIndex){.cdecl.} TSpatialIndexCountImpl* = proc (index: PSpatialIndex): cint{.cdecl.} TSpatialIndexEachImpl* = proc (index: PSpatialIndex; - func: TSpatialIndexIteratorFunc; data: pointer){. + fun: TSpatialIndexIteratorFunc; data: pointer){. cdecl.} TSpatialIndexContainsImpl* = proc (index: PSpatialIndex; obj: pointer; hashid: THashValue): Bool32 {.cdecl.} @@ -161,15 +161,15 @@ type TSpatialIndexReindexObjectImpl* = proc (index: PSpatialIndex; obj: pointer; hashid: THashValue){.cdecl.} TSpatialIndexReindexQueryImpl* = proc (index: PSpatialIndex; - func: TSpatialIndexQueryFunc; data: pointer){.cdecl.} + fun: TSpatialIndexQueryFunc; data: pointer){.cdecl.} TSpatialIndexPointQueryImpl* = proc (index: PSpatialIndex; point: TVector; - func: TSpatialIndexQueryFunc; + fun: TSpatialIndexQueryFunc; data: pointer){.cdecl.} TSpatialIndexSegmentQueryImpl* = proc (index: PSpatialIndex; obj: pointer; - a: TVector; b: TVector; t_exit: CpFloat; func: TSpatialIndexSegmentQueryFunc; + a: TVector; b: TVector; t_exit: CpFloat; fun: TSpatialIndexSegmentQueryFunc; data: pointer){.cdecl.} TSpatialIndexQueryImpl* = proc (index: PSpatialIndex; obj: pointer; - bb: TBB; func: TSpatialIndexQueryFunc; + bb: TBB; fun: TSpatialIndexQueryFunc; data: pointer){.cdecl.} PSpatialIndexClass* = ptr TSpatialIndexClass TSpatialIndexClass*{.pf.} = object @@ -286,7 +286,7 @@ type CP_CIRCLE_SHAPE, CP_SEGMENT_SHAPE, CP_POLY_SHAPE, CP_NUM_SHAPES TShapeCacheDataImpl* = proc (shape: PShape; p: TVector; rot: TVector): TBB{.cdecl.} TShapeDestroyImpl* = proc (shape: PShape){.cdecl.} - TShapePointQueryImpl* = proc (shape: PShape; p: TVector): bool32 {.cdecl.} + TShapePointQueryImpl* = proc (shape: PShape; p: TVector): Bool32 {.cdecl.} TShapeSegmentQueryImpl* = proc (shape: PShape; a: TVector; b: TVector; info: PSegmentQueryInfo){.cdecl.} PShapeClass* = ptr TShapeClass @@ -427,7 +427,7 @@ defGetter(PSpace, CpFloat, currDt, CurrentTimeStep) #/ returns true from inside a callback and objects cannot be added/removed. -proc isLocked*(space: PSpace): Bool{.inline.} = +proc isLocked*(space: PSpace): bool{.inline.} = result = space.locked.bool #/ Set a default collision handler for this space. @@ -478,24 +478,24 @@ proc removeBody*(space: PSpace; body: PBody){. proc RemoveConstraint*(space: PSpace; constraint: PConstraint){. cdecl, importc: "cpSpaceRemoveConstraint", dynlib: Lib.} #/ Test if a collision shape has been added to the space. -proc containsShape*(space: PSpace; shape: PShape): Bool{. +proc containsShape*(space: PSpace; shape: PShape): bool{. cdecl, importc: "cpSpaceContainsShape", dynlib: Lib.} #/ Test if a rigid body has been added to the space. -proc containsBody*(space: PSpace; body: PBody): Bool{. +proc containsBody*(space: PSpace; body: PBody): bool{. cdecl, importc: "cpSpaceContainsBody", dynlib: Lib.} #/ Test if a constraint has been added to the space. -proc containsConstraint*(space: PSpace; constraint: PConstraint): Bool{. +proc containsConstraint*(space: PSpace; constraint: PConstraint): bool{. cdecl, importc: "cpSpaceContainsConstraint", dynlib: Lib.} #/ Schedule a post-step callback to be called when cpSpaceStep() finishes. #/ @c obj is used a key, you can only register one callback per unique value for @c obj -proc addPostStepCallback*(space: PSpace; func: TPostStepFunc; +proc addPostStepCallback*(space: PSpace; fun: TPostStepFunc; obj: pointer; data: pointer){. cdecl, importc: "cpSpaceAddPostStepCallback", dynlib: Lib.} #/ Query the space at a point and call @c func for each shape found. proc pointQuery*(space: PSpace; point: TVector; layers: TLayers; - group: TGroup; func: TSpacePointQueryFunc; data: pointer){. + group: TGroup; fun: TSpacePointQueryFunc; data: pointer){. cdecl, importc: "cpSpacePointQuery", dynlib: Lib.} #/ Query the space at a point and return the first shape found. Returns NULL if no shapes were found. @@ -506,7 +506,7 @@ proc pointQueryFirst*(space: PSpace; point: TVector; layers: TLayers; #/ Perform a directed line segment query (like a raycast) against the space calling @c func for each shape intersected. proc segmentQuery*(space: PSpace; start: TVector; to: TVector; layers: TLayers; group: TGroup; - func: TSpaceSegmentQueryFunc; data: pointer){. + fun: TSpaceSegmentQueryFunc; data: pointer){. cdecl, importc: "cpSpaceSegmentQuery", dynlib: Lib.} #/ Perform a directed line segment query (like a raycast) against the space and return the first shape hit. Returns NULL if no shapes were hit. proc segmentQueryFirst*(space: PSpace; start: TVector; to: TVector; @@ -517,26 +517,26 @@ proc segmentQueryFirst*(space: PSpace; start: TVector; to: TVector; #/ Perform a fast rectangle query on the space calling @c func for each shape found. #/ Only the shape's bounding boxes are checked for overlap, not their full shape. proc BBQuery*(space: PSpace; bb: TBB; layers: TLayers; group: TGroup; - func: TSpaceBBQueryFunc; data: pointer){. + fun: TSpaceBBQueryFunc; data: pointer){. cdecl, importc: "cpSpaceBBQuery", dynlib: Lib.} #/ Query a space for any shapes overlapping the given shape and call @c func for each shape found. -proc shapeQuery*(space: PSpace; shape: PShape; func: TSpaceShapeQueryFunc; data: pointer): Bool {. +proc shapeQuery*(space: PSpace; shape: PShape; fun: TSpaceShapeQueryFunc; data: pointer): bool {. cdecl, importc: "cpSpaceShapeQuery", dynlib: Lib.} #/ Call cpBodyActivate() for any shape that is overlaps the given shape. proc activateShapesTouchingShape*(space: PSpace; shape: PShape){. cdecl, importc: "cpSpaceActivateShapesTouchingShape", dynlib: Lib.} #/ Call @c func for each body in the space. -proc eachBody*(space: PSpace; func: TSpaceBodyIteratorFunc; data: pointer){. +proc eachBody*(space: PSpace; fun: TSpaceBodyIteratorFunc; data: pointer){. cdecl, importc: "cpSpaceEachBody", dynlib: Lib.} #/ Call @c func for each shape in the space. -proc eachShape*(space: PSpace; func: TSpaceShapeIteratorFunc; +proc eachShape*(space: PSpace; fun: TSpaceShapeIteratorFunc; data: pointer){. cdecl, importc: "cpSpaceEachShape", dynlib: Lib.} #/ Call @c func for each shape in the space. -proc eachConstraint*(space: PSpace; func: TSpaceConstraintIteratorFunc; +proc eachConstraint*(space: PSpace; fun: TSpaceConstraintIteratorFunc; data: pointer){. cdecl, importc: "cpSpaceEachConstraint", dynlib: Lib.} #/ Update the collision detection info for the static shapes in the space. @@ -674,7 +674,7 @@ proc dist*(v1, v2: TVector): CpFloat {.inline.} = proc distsq*(v1, v2: TVector): CpFloat {.inline.} = result = (v1 - v2).lenSq #vlengthsq(vsub(v1, v2)) #/ Returns true if the distance between v1 and v2 is less than dist. -proc near*(v1, v2: TVector; dist: CpFloat): Bool{.inline.} = +proc near*(v1, v2: TVector; dist: CpFloat): bool{.inline.} = result = v1.distSq(v2) < dist * dist @@ -706,13 +706,13 @@ proc Sleep*(body: PBody){.importc: "cpBodySleep", dynlib: Lib.} proc SleepWithGroup*(body: PBody; group: PBody){. importc: "cpBodySleepWithGroup", dynlib: Lib.} #/ Returns true if the body is sleeping. -proc isSleeping*(body: PBody): Bool {.inline.} = +proc isSleeping*(body: PBody): bool {.inline.} = return body.node.root != nil #/ Returns true if the body is static. proc isStatic*(body: PBody): bool {.inline.} = return body.node.idleTime == CpInfinity #/ Returns true if the body has not been added to a space. -proc isRogue*(body: PBody): Bool {.inline.} = +proc isRogue*(body: PBody): bool {.inline.} = return body.space == nil # #define CP_DefineBodyStructGetter(type, member, name) \ @@ -808,15 +808,15 @@ proc kineticEnergy*(body: PBOdy): CpFloat = result = (body.v.dot(body.v) * body.m) + (body.w * body.w * body.i) #/ Call @c func once for each shape attached to @c body and added to the space. -proc eachShape*(body: PBody; func: TBodyShapeIteratorFunc; +proc eachShape*(body: PBody; fun: TBodyShapeIteratorFunc; data: pointer){. cdecl, importc: "cpBodyEachShape", dynlib: Lib.} #/ Call @c func once for each constraint attached to @c body and added to the space. -proc eachConstraint*(body: PBody; func: TBodyConstraintIteratorFunc; +proc eachConstraint*(body: PBody; fun: TBodyConstraintIteratorFunc; data: pointer) {. cdecl, importc: "cpBodyEachConstraint", dynlib: Lib.} #/ Call @c func once for each arbiter that is currently active on the body. -proc eachArbiter*(body: PBody; func: TBodyArbiterIteratorFunc; +proc eachArbiter*(body: PBody; fun: TBodyArbiterIteratorFunc; data: pointer){. cdecl, importc: "cpBodyEachArbiter", dynlib: Lib.} #/ Allocate a spatial hash. @@ -824,10 +824,10 @@ proc SpaceHashAlloc*(): PSpaceHash{. cdecl, importc: "cpSpaceHashAlloc", dynlib: Lib.} #/ Initialize a spatial hash. proc SpaceHashInit*(hash: PSpaceHash; celldim: CpFloat; numcells: cint; - bbfunc: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. + bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. cdecl, importc: "cpSpaceHashInit", dynlib: Lib.} #/ Allocate and initialize a spatial hash. -proc SpaceHashNew*(celldim: CpFloat; cells: cint; bbfunc: TSpatialIndexBBFunc; +proc SpaceHashNew*(celldim: CpFloat; cells: cint; bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. cdecl, importc: "cpSpaceHashNew", dynlib: Lib.} #/ Change the cell dimensions and table size of the spatial hash to tune it. @@ -842,18 +842,18 @@ proc SpaceHashResize*(hash: PSpaceHash; celldim: CpFloat; numcells: cint){. #/ Allocate a bounding box tree. proc BBTreeAlloc*(): PBBTree{.cdecl, importc: "cpBBTreeAlloc", dynlib: Lib.} #/ Initialize a bounding box tree. -proc BBTreeInit*(tree: PBBTree; bbfunc: TSpatialIndexBBFunc; +proc BBTreeInit*(tree: PBBTree; bbfun: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl, importc: "cpBBTreeInit", dynlib: Lib.} #/ Allocate and initialize a bounding box tree. -proc BBTreeNew*(bbfunc: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. +proc BBTreeNew*(bbfun: TSpatialIndexBBFunc; staticIndex: PSpatialIndex): PSpatialIndex{. cdecl, importc: "cpBBTreeNew", dynlib: Lib.} #/ Perform a static top down optimization of the tree. proc BBTreeOptimize*(index: PSpatialIndex){. cdecl, importc: "cpBBTreeOptimize", dynlib: Lib.} #/ Set the velocity function for the bounding box tree to enable temporal coherence. -proc BBTreeSetVelocityFunc*(index: PSpatialIndex; func: TBBTreeVelocityFunc){. +proc BBTreeSetVelocityFunc*(index: PSpatialIndex; fun: TBBTreeVelocityFunc){. cdecl, importc: "cpBBTreeSetVelocityFunc", dynlib: Lib.} #MARK: Single Axis Sweep @@ -864,12 +864,12 @@ proc Sweep1DAlloc*(): ptr TSweep1D{.cdecl, importc: "cpSweep1DAlloc", dynlib: Lib.} #/ Initialize a 1D sort and sweep broadphase. -proc Sweep1DInit*(sweep: ptr TSweep1D; bbfunc: TSpatialIndexBBFunc; +proc Sweep1DInit*(sweep: ptr TSweep1D; bbfun: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{.cdecl, importc: "cpSweep1DInit", dynlib: Lib.} #/ Allocate and initialize a 1D sort and sweep broadphase. -proc Sweep1DNew*(bbfunc: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{. +proc Sweep1DNew*(bbfun: TSpatialIndexBBFunc; staticIndex: ptr TSpatialIndex): ptr TSpatialIndex{. cdecl, importc: "cpSweep1DNew", dynlib: Lib.} @@ -1359,7 +1359,7 @@ defCProp(SlideJoint, TVector, anchr2, Anchr2) defCProp(SlideJoint, CpFloat, min, Min) defCProp(SlideJoint, CpFloat, max, Max) -proc pivotJointGetClass*(): PConstraintClass {. +proc PivotJointGetClass*(): PConstraintClass {. cdecl, importc: "cpPivotJointGetClass", dynlib: Lib.} #/ Allocate a pivot joint diff --git a/tests/manyloc/keineschweine/dependencies/enet/enet.nim b/tests/manyloc/keineschweine/dependencies/enet/enet.nim index df1b743ee..93857207a 100644 --- a/tests/manyloc/keineschweine/dependencies/enet/enet.nim +++ b/tests/manyloc/keineschweine/dependencies/enet/enet.nim @@ -20,7 +20,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. const Lib = "libenet.so.1(|.0.3)" -{.deadCodeElim: ON.} +{.deadCodeElim: on.} const ENET_VERSION_MAJOR* = 1 ENET_VERSION_MINOR* = 3 diff --git a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim index 44d00db53..4f2fb1ea3 100644 --- a/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim +++ b/tests/manyloc/keineschweine/dependencies/genpacket/genpacket_enet.nim @@ -9,15 +9,6 @@ template defPacketImports*(): stmt {.immediate, dirty.} = import macros, macro_dsl, estreams from strutils import format -proc `$`*[T](x: seq[T]): string = - result = "[seq len=" - result.add($x.len) - result.add ':' - for i in 0.. <len(x): - result.add " " - result.add($x[i]) - result.add ']' - macro defPacket*(typeNameN: expr, typeFields: expr): stmt {.immediate.} = result = newNimNode(nnkStmtList) let @@ -293,4 +284,4 @@ when isMainModule: for itm in test.x: echo(itm) test.pack(s) - echo(repr(s.data)) \ No newline at end of file + echo(repr(s.data)) diff --git a/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim b/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim index 0d09d40e3..1071ec767 100644 --- a/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim +++ b/tests/manyloc/keineschweine/dependencies/sfml/sfml.nim @@ -221,10 +221,10 @@ type TTransform* {.pf.} = object matrix*: array[0..8, cfloat] TColor* {.pf.} = object - r*: Uint8 - g*: Uint8 - b*: Uint8 - a*: Uint8 + r*: uint8 + g*: uint8 + b*: uint8 + a*: uint8 PFloatRect* = ptr TFloatRect TFloatRect*{.pf.} = object left*: cfloat @@ -306,7 +306,7 @@ proc close*(window: PRenderWindow) {. proc isOpen*(window: PRenderWindow): bool {. cdecl, importc: "sfRenderWindow_isOpen", dynlib: LibG.} -#void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfUint8* pixels); +#void sfRenderWindow_setIcon(sfRenderWindow* renderWindow, unsigned int width, unsigned int height, const sfuint8* pixels); #proc setIcon*(window: PRenderWindow, width, height: cint, pixels: seq[uint8]) {. # cdecl, importc: "sfRenderWindow_setIcon", dynlib: LibG.} @@ -395,7 +395,7 @@ proc capture*(window: PRenderWindow): PImage {. cdecl, importc: "sfRenderWindow_capture", dynlib: LibG.} #Construct a new render texture -proc newRenderTexture*(width, height: cint; depthBuffer: Bool): PRenderTexture {. +proc newRenderTexture*(width, height: cint; depthBuffer: bool): PRenderTexture {. cdecl, importc: "sfRenderTexture_create", dynlib: LibG.} #Destroy an existing render texture proc destroy*(renderTexture: PRenderTexture){. @@ -522,9 +522,9 @@ proc copy*(font: PFont): PFont {. cdecl, importc: "sfFont_copy", dynlib: LibG.} proc destroy*(font: PFont) {. cdecl, importc: "sfFont_destroy", dynlib: LibG.} -proc getGlyph*(font: PFont, codePoint: Uint32, characterSize: cint, bold: bool): TGlyph{. +proc getGlyph*(font: PFont, codePoint: uint32, characterSize: cint, bold: bool): TGlyph{. cdecl, importc: "sfFont_getGlyph", dynlib: LibG.} -proc getKerning*(font: PFont, first: Uint32, second: Uint32, characterSize: cint): cint {. +proc getKerning*(font: PFont, first: uint32, second: uint32, characterSize: cint): cint {. cdecl, importc: "sfFont_getKerning", dynlib: LibG.} proc getLineSpacing*(font: PFont, characterSize: cint): cint {. cdecl, importc: "sfFont_getLineSpacing", dynlib: LibG.} @@ -882,7 +882,7 @@ proc getInverseTransform*(text: PText): TTransform {. cdecl, importc: "sfText_getInverseTransform", dynlib: LibG.} proc setString*(text: PText, string: cstring) {. cdecl, importc: "sfText_setString", dynlib: LibG.} -proc setUnicodeString*(text: PText, string: ptr Uint32) {. +proc setUnicodeString*(text: PText, string: ptr uint32) {. cdecl, importc: "sfText_setUnicodeString", dynlib: LibG.} proc setFont*(text: PText, font: PFont) {. cdecl, importc: "sfText_setFont", dynlib: LibG.} @@ -894,13 +894,13 @@ proc setColor*(text: PText, color: TColor) {. cdecl, importc: "sfText_setColor", dynlib: LibG.} proc getString*(text: PText): cstring {. cdecl, importc: "sfText_getString", dynlib: LibG.} -proc getUnicodeString*(text: PText): ptr Uint32 {.cdecl, +proc getUnicodeString*(text: PText): ptr uint32 {.cdecl, importc: "sfText_getUnicodeString", dynlib: LibG.} proc getFont*(text: PText): PFont {. cdecl, importc: "sfText_getFont", dynlib: LibG.} proc getCharacterSize*(text: PText): cint {. cdecl, importc: "sfText_getCharacterSize", dynlib: LibG.} -proc getStyle*(text: PText): Uint32 {. +proc getStyle*(text: PText): uint32 {. cdecl, importc: "sfText_getStyle", dynlib: LibG.} proc getColor*(text: PText): TColor {. cdecl, importc: "sfText_getColor", dynlib: LibG.} diff --git a/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim b/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim index 3cfd33c02..5aa017ac4 100644 --- a/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim +++ b/tests/manyloc/keineschweine/dependencies/sfml/sfml_audio.nim @@ -284,7 +284,7 @@ proc newSoundBuffer*(stream: PInputStream): PSoundBuffer{. #/ \brief Create a new sound buffer and load it from an array of samples in memory #/ #/ The assumed format of the audio samples is 16 bits signed integer -#/ (sfInt16). +#/ (sfint16). #/ #/ \param samples Pointer to the array of samples in memory #/ \param sampleCount Number of samples in the array @@ -334,7 +334,7 @@ proc saveToFile*(soundBuffer: PSoundBuffer; filename: cstring): bool {. #/ \brief Get the array of audio samples stored in a sound buffer #/ #/ The format of the returned samples is 16 bits signed integer -#/ (sfInt16). The total number of samples in this array +#/ (sfint16). The total number of samples in this array #/ is given by the sfSoundBuffer_getSampleCount function. #/ #/ \param soundBuffer Sound buffer object @@ -342,7 +342,7 @@ proc saveToFile*(soundBuffer: PSoundBuffer; filename: cstring): bool {. #/ \return Read-only pointer to the array of sound samples #/ #////////////////////////////////////////////////////////// -proc sfSoundBuffer_getSamples*(soundBuffer: PSoundBuffer): ptr Int16{. +proc sfSoundBuffer_getSamples*(soundBuffer: PSoundBuffer): ptr int16{. cdecl, importc: "sfSoundBuffer_getSamples", dynlib: Lib.} #////////////////////////////////////////////////////////// #/ \brief Get the number of samples stored in a sound buffer diff --git a/tests/manyloc/keineschweine/enet_server/enet_client.nim b/tests/manyloc/keineschweine/enet_server/enet_client.nim index 0c903a733..5ebbdb88b 100644 --- a/tests/manyloc/keineschweine/enet_server/enet_client.nim +++ b/tests/manyloc/keineschweine/enet_server/enet_client.nim @@ -105,6 +105,7 @@ proc tryLogin*(b: PButton) = passwd = u_passwd.getText()) dirServer.send HLogin, login proc tryTransition*(b: PButton) = + discard #zone.writePkt HZoneJoinReq, myCreds proc tryConnect*(b: PButton) = if not dirServer.connected: diff --git a/tests/manyloc/keineschweine/keineschweine.nim b/tests/manyloc/keineschweine/keineschweine.nim index e868b96a5..0a5dc1efc 100644 --- a/tests/manyloc/keineschweine/keineschweine.nim +++ b/tests/manyloc/keineschweine/keineschweine.nim @@ -143,7 +143,7 @@ proc mouseToSpace*(): TVector = proc explode*(b: PLiveBullet) ## TCollisionBeginFunc proc collisionBulletPlayer(arb: PArbiter; space: PSpace; - data: pointer): Bool{.cdecl.} = + data: pointer): bool{.cdecl.} = var bullet = cast[PLiveBullet](arb.a.data) target = cast[PVehicle](arb.b.data) @@ -152,7 +152,7 @@ proc collisionBulletPlayer(arb: PArbiter; space: PSpace; proc angularDampingSim(body: PBody, gravity: TVector, damping, dt: CpFloat){.cdecl.} = body.w -= (body.w * 0.98 * dt) - body.updateVelocity(gravity, damping, dt) + body.UpdateVelocity(gravity, damping, dt) proc initLevel() = loadAllAssets() @@ -227,7 +227,7 @@ proc explode*(b: PLiveBullet) = playSound(b.record.explosion.sound, b.body.getPos()) proc bulletUpdate(body: PBody, gravity: TVector, damping, dt: CpFloat){.cdecl.} = - body.updateVelocity(gravity, damping, dt) + body.UpdateVelocity(gravity, damping, dt) template getPhysical() {.immediate.} = result.body = space.addBody(newBody( @@ -237,7 +237,7 @@ template getPhysical() {.immediate.} = chipmunk.newCircleShape( result.body, record.physics.radius, - vectorZero)) + VectorZero)) proc newBullet*(record: PBulletRecord; fromPlayer: PPlayer): PLiveBullet = new(result, free) @@ -480,7 +480,7 @@ when defined(DebugKeys): echo(repr(activeVehicle.record)) elif keyPressed(KeyH): activeVehicle.body.setPos(vector(100.0, 100.0)) - activeVehicle.body.setVel(vectorZero) + activeVehicle.body.setVel(VectorZero) elif keyPressed(KeyComma): activeVehicle.body.setPos mouseToSpace()) ingameClient.registerHandler(KeyY, down, proc() = @@ -507,7 +507,7 @@ when defined(DebugKeys): return let body = shape.getBody() mouseJoint = space.addConstraint( - newPivotJoint(mouseBody, body, vectorZero, body.world2local(point))) + newPivotJoint(mouseBody, body, VectorZero, body.world2local(point))) mouseJoint.maxForce = 50000.0 mouseJoint.errorBias = pow(1.0 - 0.15, 60)) @@ -539,15 +539,15 @@ proc mainUpdate(dt: float) = elif not activeVehicle.isNil: if keyPressed(KeyUp): activeVehicle.accel(dt) - elif keyPressed(keyDown): + elif keyPressed(KeyDown): activeVehicle.reverse(dt) if keyPressed(KeyRight): activeVehicle.turn_right(dt) elif keyPressed(KeyLeft): activeVehicle.turn_left(dt) - if keyPressed(keyz): + if keyPressed(Keyz): activeVehicle.strafe_left(dt) - elif keyPressed(keyx): + elif keyPressed(Keyx): activeVehicle.strafe_right(dt) if keyPressed(KeyLControl): localPlayer.useItem 0 @@ -557,7 +557,7 @@ proc mainUpdate(dt: float) = localPlayer.useItem 2 if keyPressed(KeyW): localPlayer.useItem 3 - if Keypressed(keyA): + if keyPressed(KeyA): localPlayer.useItem 4 if keyPressed(sfml.KeyS): localPlayer.useItem 5 @@ -666,7 +666,7 @@ when isMainModule: import parseopt localPlayer = newPlayer() - LobbyInit() + lobbyInit() videoMode = getClientSettings().resolution window = newRenderWindow(videoMode, "sup", sfDefaultStyle) @@ -683,7 +683,7 @@ when isMainModule: mouseSprite.setOutlineThickness 1.4 mouseSprite.setOrigin vec2f(14, 14) - LobbyReady() + lobbyReady() playBtn = specGui.newButton( "Unspec - F12", position = vec2f(680.0, 8.0), onClick = proc(b: PButton) = toggleSpec()) diff --git a/tests/manyloc/keineschweine/lib/game_objects.nim b/tests/manyloc/keineschweine/lib/game_objects.nim index 37019ebcb..277ffb6cb 100644 --- a/tests/manyloc/keineschweine/lib/game_objects.nim +++ b/tests/manyloc/keineschweine/lib/game_objects.nim @@ -26,7 +26,7 @@ proc newObject*(record: PObjectRecord): PGameObject = when false: result.sprite = record.anim.spriteSheet.sprite.copy() result.body = newBody(result.record.physics.mass, 10.0) - result.shape = chipmunk.newCircleShape(result.body, result.record.physics.radius, vectorZero) + result.shape = chipmunk.newCircleShape(result.body, result.record.physics.radius, VectorZero) result.body.setPos(vector(100, 100)) proc newObject*(name: string): PGameObject = result = newObject(fetchObj(name)) diff --git a/tests/manyloc/keineschweine/lib/gl.nim b/tests/manyloc/keineschweine/lib/gl.nim index 9387b5bc9..c577f3404 100644 --- a/tests/manyloc/keineschweine/lib/gl.nim +++ b/tests/manyloc/keineschweine/lib/gl.nim @@ -38,7 +38,7 @@ type PGLclampf* = ptr TGLclampf PGLdouble* = ptr TGLdouble PGLclampd* = ptr TGLclampd - PGLvoid* = Pointer + PGLvoid* = pointer PPGLvoid* = ptr PGLvoid TGLenum* = cint TGLboolean* = bool @@ -983,7 +983,7 @@ const # Version GL_TEXTURE_COMPONENTS* = GL_TEXTURE_INTERNAL_FORMAT proc glAccum*(op: TGLenum, value: TGLfloat){.dynlib: dllname, importc: "glAccum".} -proc glAlphaFunc*(func: TGLenum, theref: TGLclampf){.dynlib: dllname, +proc glAlphaFunc*(fun: TGLenum, theref: TGLclampf){.dynlib: dllname, importc: "glAlphaFunc".} proc glAreTexturesResident*(n: TGLsizei, textures: PGLuint, residences: PGLboolean): TGLboolean{. @@ -998,7 +998,7 @@ proc glBitmap*(width, height: TGLsizei, xorig, yorig: TGLfloat, proc glBlendFunc*(sfactor, dfactor: TGLenum){.dynlib: dllname, importc: "glBlendFunc".} proc glCallList*(list: TGLuint){.dynlib: dllname, importc: "glCallList".} -proc glCallLists*(n: TGLsizei, atype: TGLenum, lists: Pointer){.dynlib: dllname, +proc glCallLists*(n: TGLsizei, atype: TGLenum, lists: pointer){.dynlib: dllname, importc: "glCallLists".} proc glClear*(mask: TGLbitfield){.dynlib: dllname, importc: "glClear".} proc glClearAccum*(red, green, blue, alpha: TGLfloat){.dynlib: dllname, @@ -1062,7 +1062,7 @@ proc glColorMask*(red, green, blue, alpha: TGLboolean){.dynlib: dllname, proc glColorMaterial*(face, mode: TGLenum){.dynlib: dllname, importc: "glColorMaterial".} proc glColorPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei, - pointer: Pointer){.dynlib: dllname, + p: pointer){.dynlib: dllname, importc: "glColorPointer".} proc glCopyPixels*(x, y: TGLint, width, height: TGLsizei, atype: TGLenum){. dynlib: dllname, importc: "glCopyPixels".} @@ -1084,7 +1084,7 @@ proc glDeleteLists*(list: TGLuint, range: TGLsizei){.dynlib: dllname, importc: "glDeleteLists".} proc glDeleteTextures*(n: TGLsizei, textures: PGLuint){.dynlib: dllname, importc: "glDeleteTextures".} -proc glDepthFunc*(func: TGLenum){.dynlib: dllname, importc: "glDepthFunc".} +proc glDepthFunc*(fun: TGLenum){.dynlib: dllname, importc: "glDepthFunc".} proc glDepthMask*(flag: TGLboolean){.dynlib: dllname, importc: "glDepthMask".} proc glDepthRange*(zNear, zFar: TGLclampd){.dynlib: dllname, importc: "glDepthRange".} @@ -1095,12 +1095,12 @@ proc glDrawArrays*(mode: TGLenum, first: TGLint, count: TGLsizei){. dynlib: dllname, importc: "glDrawArrays".} proc glDrawBuffer*(mode: TGLenum){.dynlib: dllname, importc: "glDrawBuffer".} proc glDrawElements*(mode: TGLenum, count: TGLsizei, atype: TGLenum, - indices: Pointer){.dynlib: dllname, + indices: pointer){.dynlib: dllname, importc: "glDrawElements".} proc glDrawPixels*(width, height: TGLsizei, format, atype: TGLenum, - pixels: Pointer){.dynlib: dllname, importc: "glDrawPixels".} + pixels: pointer){.dynlib: dllname, importc: "glDrawPixels".} proc glEdgeFlag*(flag: TGLboolean){.dynlib: dllname, importc: "glEdgeFlag".} -proc glEdgeFlagPointer*(stride: TGLsizei, pointer: Pointer){.dynlib: dllname, +proc glEdgeFlagPointer*(stride: TGLsizei, p: pointer){.dynlib: dllname, importc: "glEdgeFlagPointer".} proc glEdgeFlagv*(flag: PGLboolean){.dynlib: dllname, importc: "glEdgeFlagv".} proc glEnable*(cap: TGLenum){.dynlib: dllname, importc: "glEnable".} @@ -1171,7 +1171,7 @@ proc glGetPixelMapuiv*(map: TGLenum, values: PGLuint){.dynlib: dllname, importc: "glGetPixelMapuiv".} proc glGetPixelMapusv*(map: TGLenum, values: PGLushort){.dynlib: dllname, importc: "glGetPixelMapusv".} -proc glGetPointerv*(pname: TGLenum, params: Pointer){.dynlib: dllname, +proc glGetPointerv*(pname: TGLenum, params: pointer){.dynlib: dllname, importc: "glGetPointerv".} proc glGetPolygonStipple*(mask: PGLubyte){.dynlib: dllname, importc: "glGetPolygonStipple".} @@ -1188,10 +1188,10 @@ proc glGetTexGenfv*(coord, pname: TGLenum, params: PGLfloat){.dynlib: dllname, proc glGetTexGeniv*(coord, pname: TGLenum, params: PGLint){.dynlib: dllname, importc: "glGetTexGeniv".} proc glGetTexImage*(target: TGLenum, level: TGLint, format: TGLenum, - atype: TGLenum, pixels: Pointer){.dynlib: dllname, + atype: TGLenum, pixels: pointer){.dynlib: dllname, importc: "glGetTexImage".} proc glGetTexLevelParameterfv*(target: TGLenum, level: TGLint, pname: TGLenum, - params: Pointer){.dynlib: dllname, + params: pointer){.dynlib: dllname, importc: "glGetTexLevelParameterfv".} proc glGetTexLevelParameteriv*(target: TGLenum, level: TGLint, pname: TGLenum, params: PGLint){.dynlib: dllname, @@ -1202,7 +1202,7 @@ proc glGetTexParameteriv*(target, pname: TGLenum, params: PGLint){. dynlib: dllname, importc: "glGetTexParameteriv".} proc glHint*(target, mode: TGLenum){.dynlib: dllname, importc: "glHint".} proc glIndexMask*(mask: TGLuint){.dynlib: dllname, importc: "glIndexMask".} -proc glIndexPointer*(atype: TGLenum, stride: TGLsizei, pointer: Pointer){. +proc glIndexPointer*(atype: TGLenum, stride: TGLsizei, p: pointer){. dynlib: dllname, importc: "glIndexPointer".} proc glIndexd*(c: TGLdouble){.dynlib: dllname, importc: "glIndexd".} proc glIndexdv*(c: PGLdouble){.dynlib: dllname, importc: "glIndexdv".} @@ -1215,7 +1215,7 @@ proc glIndexsv*(c: PGLshort){.dynlib: dllname, importc: "glIndexsv".} proc glIndexub*(c: TGLubyte){.dynlib: dllname, importc: "glIndexub".} proc glIndexubv*(c: PGLubyte){.dynlib: dllname, importc: "glIndexubv".} proc glInitNames*(){.dynlib: dllname, importc: "glInitNames".} -proc glInterleavedArrays*(format: TGLenum, stride: TGLsizei, pointer: Pointer){. +proc glInterleavedArrays*(format: TGLenum, stride: TGLsizei, p: pointer){. dynlib: dllname, importc: "glInterleavedArrays".} proc glIsEnabled*(cap: TGLenum): TGLboolean{.dynlib: dllname, importc: "glIsEnabled".} @@ -1288,7 +1288,7 @@ proc glNormal3i*(nx, ny, nz: TGLint){.dynlib: dllname, importc: "glNormal3i".} proc glNormal3iv*(v: PGLint){.dynlib: dllname, importc: "glNormal3iv".} proc glNormal3s*(nx, ny, nz: TGLshort){.dynlib: dllname, importc: "glNormal3s".} proc glNormal3sv*(v: PGLshort){.dynlib: dllname, importc: "glNormal3sv".} -proc glNormalPointer*(atype: TGLenum, stride: TGLsizei, pointer: Pointer){. +proc glNormalPointer*(atype: TGLenum, stride: TGLsizei, p: pointer){. dynlib: dllname, importc: "glNormalPointer".} proc glOrtho*(left, right, bottom, top, zNear, zFar: TGLdouble){. dynlib: dllname, importc: "glOrtho".} @@ -1360,7 +1360,7 @@ proc glRasterPos4s*(x, y, z, w: TGLshort){.dynlib: dllname, proc glRasterPos4sv*(v: PGLshort){.dynlib: dllname, importc: "glRasterPos4sv".} proc glReadBuffer*(mode: TGLenum){.dynlib: dllname, importc: "glReadBuffer".} proc glReadPixels*(x, y: TGLint, width, height: TGLsizei, - format, atype: TGLenum, pixels: Pointer){.dynlib: dllname, + format, atype: TGLenum, pixels: pointer){.dynlib: dllname, importc: "glReadPixels".} proc glRectd*(x1, y1, x2, y2: TGLdouble){.dynlib: dllname, importc: "glRectd".} proc glRectdv*(v1: PGLdouble, v2: PGLdouble){.dynlib: dllname, @@ -1383,7 +1383,7 @@ proc glScissor*(x, y: TGLint, width, height: TGLsizei){.dynlib: dllname, proc glSelectBuffer*(size: TGLsizei, buffer: PGLuint){.dynlib: dllname, importc: "glSelectBuffer".} proc glShadeModel*(mode: TGLenum){.dynlib: dllname, importc: "glShadeModel".} -proc glStencilFunc*(func: TGLenum, theref: TGLint, mask: TGLuint){. +proc glStencilFunc*(fun: TGLenum, theref: TGLint, mask: TGLuint){. dynlib: dllname, importc: "glStencilFunc".} proc glStencilMask*(mask: TGLuint){.dynlib: dllname, importc: "glStencilMask".} proc glStencilOp*(fail, zfail, zpass: TGLenum){.dynlib: dllname, @@ -1424,7 +1424,7 @@ proc glTexCoord4s*(s, t, r, q: TGLshort){.dynlib: dllname, importc: "glTexCoord4s".} proc glTexCoord4sv*(v: PGLshort){.dynlib: dllname, importc: "glTexCoord4sv".} proc glTexCoordPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei, - pointer: Pointer){.dynlib: dllname, + p: pointer){.dynlib: dllname, importc: "glTexCoordPointer".} proc glTexEnvf*(target: TGLenum, pname: TGLenum, param: TGLfloat){. dynlib: dllname, importc: "glTexEnvf".} @@ -1448,10 +1448,10 @@ proc glTexGeniv*(coord: TGLenum, pname: TGLenum, params: PGLint){. dynlib: dllname, importc: "glTexGeniv".} proc glTexImage1D*(target: TGLenum, level, internalformat: TGLint, width: TGLsizei, border: TGLint, format, atype: TGLenum, - pixels: Pointer){.dynlib: dllname, importc: "glTexImage1D".} + pixels: pointer){.dynlib: dllname, importc: "glTexImage1D".} proc glTexImage2D*(target: TGLenum, level, internalformat: TGLint, width, height: TGLsizei, border: TGLint, - format, atype: TGLenum, pixels: Pointer){.dynlib: dllname, + format, atype: TGLenum, pixels: pointer){.dynlib: dllname, importc: "glTexImage2D".} proc glTexParameterf*(target: TGLenum, pname: TGLenum, param: TGLfloat){. dynlib: dllname, importc: "glTexParameterf".} @@ -1462,11 +1462,11 @@ proc glTexParameteri*(target: TGLenum, pname: TGLenum, param: TGLint){. proc glTexParameteriv*(target: TGLenum, pname: TGLenum, params: PGLint){. dynlib: dllname, importc: "glTexParameteriv".} proc glTexSubImage1D*(target: TGLenum, level, xoffset: TGLint, width: TGLsizei, - format, atype: TGLenum, pixels: Pointer){.dynlib: dllname, + format, atype: TGLenum, pixels: pointer){.dynlib: dllname, importc: "glTexSubImage1D".} proc glTexSubImage2D*(target: TGLenum, level, xoffset, yoffset: TGLint, width, height: TGLsizei, format, atype: TGLenum, - pixels: Pointer){.dynlib: dllname, + pixels: pointer){.dynlib: dllname, importc: "glTexSubImage2D".} proc glTranslated*(x, y, z: TGLdouble){.dynlib: dllname, importc: "glTranslated".} proc glTranslatef*(x, y, z: TGLfloat){.dynlib: dllname, importc: "glTranslatef".} @@ -1495,7 +1495,7 @@ proc glVertex4iv*(v: PGLint){.dynlib: dllname, importc: "glVertex4iv".} proc glVertex4s*(x, y, z, w: TGLshort){.dynlib: dllname, importc: "glVertex4s".} proc glVertex4sv*(v: PGLshort){.dynlib: dllname, importc: "glVertex4sv".} proc glVertexPointer*(size: TGLint, atype: TGLenum, stride: TGLsizei, - pointer: Pointer){.dynlib: dllname, + p: pointer){.dynlib: dllname, importc: "glVertexPointer".} proc glViewport*(x, y: TGLint, width, height: TGLsizei){.dynlib: dllname, importc: "glViewport".} @@ -1505,28 +1505,28 @@ type count: TGLsizei) PFN_GLVERTEX_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, stride, count: TGLsizei, - pointer: Pointer) + p: pointer) PFN_GLNORMAL_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei, - pointer: Pointer) + p: pointer) PFN_GLCOLOR_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, - stride, count: TGLsizei, pointer: Pointer) + stride, count: TGLsizei, p: pointer) PFN_GLINDEX_POINTER_EXTPROC* = proc (atype: TGLenum, stride, count: TGLsizei, - pointer: Pointer) + p: pointer) PFN_GLTEXCOORD_POINTER_EXTPROC* = proc (size: TGLint, atype: TGLenum, - stride, count: TGLsizei, pointer: Pointer) + stride, count: TGLsizei, p: pointer) PFN_GLEDGEFLAG_POINTER_EXTPROC* = proc (stride, count: TGLsizei, pointer: PGLboolean) - PFN_GLGET_POINTER_VEXT_PROC* = proc (pname: TGLenum, params: Pointer) + PFN_GLGET_POINTER_VEXT_PROC* = proc (pname: TGLenum, params: pointer) PFN_GLARRAY_ELEMENT_ARRAY_EXTPROC* = proc (mode: TGLenum, count: TGLsizei, - pi: Pointer) # WIN_swap_hint + pi: pointer) # WIN_swap_hint PFN_GLADDSWAPHINT_RECT_WINPROC* = proc (x, y: TGLint, width, height: TGLsizei) PFN_GLCOLOR_TABLE_EXTPROC* = proc (target, internalFormat: TGLenum, width: TGLsizei, format, atype: TGLenum, - data: Pointer) + data: pointer) PFN_GLCOLOR_SUBTABLE_EXTPROC* = proc (target: TGLenum, start, count: TGLsizei, - format, atype: TGLenum, data: Pointer) + format, atype: TGLenum, data: pointer) PFN_GLGETCOLOR_TABLE_EXTPROC* = proc (target, format, atype: TGLenum, - data: Pointer) + data: pointer) PFN_GLGETCOLOR_TABLE_PARAMETER_IVEXTPROC* = proc (target, pname: TGLenum, params: PGLint) PFN_GLGETCOLOR_TABLE_PARAMETER_FVEXTPROC* = proc (target, pname: TGLenum, diff --git a/tests/manyloc/keineschweine/lib/map_filter.nim b/tests/manyloc/keineschweine/lib/map_filter.nim index 54173fa61..966b84b6a 100644 --- a/tests/manyloc/keineschweine/lib/map_filter.nim +++ b/tests/manyloc/keineschweine/lib/map_filter.nim @@ -4,14 +4,14 @@ template filterIt2*(seq, pred: expr, body: stmt): stmt {.immediate, dirty.} = for it in items(seq): if pred: body -proc map*[A, B](x: seq[A], func: proc(y: A): B {.closure.}): seq[B] = +proc map*[A, B](x: seq[A], fun: proc(y: A): B {.closure.}): seq[B] = result = @[] for item in x.items: - result.add func(item) + result.add fun(item) -proc mapInPlace*[A](x: var seq[A], func: proc(y: A): A {.closure.}) = +proc mapInPlace*[A](x: var seq[A], fun: proc(y: A): A {.closure.}) = for i in 0..x.len-1: - x[i] = func(x[i]) + x[i] = fun(x[i]) template unless*(condition: expr; body: stmt): stmt {.dirty.} = if not(condition): @@ -38,4 +38,4 @@ when isMainModule: var someSeq = @[9,8,7,6,5,4,3,2,1] ## numbers < 6 or even filterIt2 someSeq, it < 6 or (it and 1) == 0: echo(it) - echo "-----------" \ No newline at end of file + echo "-----------" diff --git a/tests/manyloc/keineschweine/lib/sg_assets.nim b/tests/manyloc/keineschweine/lib/sg_assets.nim index ccd1d9280..c5a39550a 100644 --- a/tests/manyloc/keineschweine/lib/sg_assets.nim +++ b/tests/manyloc/keineschweine/lib/sg_assets.nim @@ -122,9 +122,9 @@ var nameToBulletID*: TTable[string, int] activeState = Lobby -proc newSprite(filename: string; errors: var seq[string]): PSpriteSheet +proc newSprite*(filename: string; errors: var seq[string]): PSpriteSheet proc load*(ss: PSpriteSheet): bool {.discardable.} -proc newSound(filename: string; errors: var seq[string]): PSoundRecord +proc newSound*(filename: string; errors: var seq[string]): PSoundRecord proc load*(s: PSoundRecord): bool {.discardable.} proc validateSettings*(settings: PJsonNode; errors: var seq[string]): bool @@ -146,7 +146,7 @@ proc importHandling(data: PJsonNode): THandlingRecord proc importBullet(data: PJsonNode; errors: var seq[string]): PBulletRecord proc importSoul(data: PJsonNode): TSoulRecord proc importExplosion(data: PJsonNode; errors: var seq[string]): TExplosionRecord -proc importSound(data: PJsonNode; errors: var seq[string]; fieldName: string = nil): PSoundRecord +proc importSound*(data: PJsonNode; errors: var seq[string]; fieldName: string = nil): PSoundRecord ## this is the only pipe between lobby and main.nim proc getActiveState*(): TGameState = @@ -466,7 +466,7 @@ proc importPhys(data: PJsonNode): TPhysicsRecord = phys.getField("radius", result.radius) phys.getField("mass", result.mass) when not defined(NoChipmunk): - result.moment = momentForCircle(result.mass, 0.0, result.radius, vectorZero) * MomentMult + result.moment = momentForCircle(result.mass, 0.0, result.radius, VectorZero) * MomentMult proc importHandling(data: PJsonNode): THandlingRecord = result.thrust = 45.0 result.topSpeed = 100.0 #unused diff --git a/tests/manyloc/keineschweine/lib/sg_packets.nim b/tests/manyloc/keineschweine/lib/sg_packets.nim index 625436cb6..601054b47 100644 --- a/tests/manyloc/keineschweine/lib/sg_packets.nim +++ b/tests/manyloc/keineschweine/lib/sg_packets.nim @@ -9,8 +9,8 @@ template idpacket(pktName, id, s2c, c2s: expr): stmt {.immediate, dirty.} = defPacket(`Sc pktName`, s2c) defPacket(`Cs pktName`, c2s) -forwardPacketT(Uint8, int8) -forwardPacketT(Uint16, int16) +forwardPacketT(uint8, int8) +forwardPacketT(uint16, int16) forwardPacketT(TPort, int16) idPacket(Login, 'a', @@ -51,7 +51,7 @@ defPacket(ScTeamList, tuple[teams: seq[ScTeam]]) let HTeamChange* = 't' idPacket(ZoneQuery, 'Q', - tuple[playerCount: Uint16], ##i should include a time here or something + tuple[playerCount: uint16], ##i should include a time here or something tuple[pad: char = '\0']) type SpawnKind = enum diff --git a/tests/manyloc/keineschweine/lib/vehicles.nim b/tests/manyloc/keineschweine/lib/vehicles.nim index edbd84ff9..4b11856c6 100644 --- a/tests/manyloc/keineschweine/lib/vehicles.nim +++ b/tests/manyloc/keineschweine/lib/vehicles.nim @@ -9,22 +9,22 @@ proc accel*(obj: PVehicle, dt: float) = # sin(obj.angle) * obj.record.handling.thrust.float * dt) obj.body.applyImpulse( vectorForAngle(obj.body.getAngle()) * dt * obj.record.handling.thrust, - vectorZero) + VectorZero) proc reverse*(obj: PVehicle, dt: float) = #obj.velocity += vec2f( # -cos(obj.angle) * obj.record.handling.reverse.float * dt, # -sin(obj.angle) * obj.record.handling.reverse.float * dt) obj.body.applyImpulse( -vectorForAngle(obj.body.getAngle()) * dt * obj.record.handling.reverse, - vectorZero) + VectorZero) proc strafe_left*(obj: PVehicle, dt: float) = obj.body.applyImpulse( vectorForAngle(obj.body.getAngle()).perp() * obj.record.handling.strafe * dt, - vectorZero) + VectorZero) proc strafe_right*(obj: PVehicle, dt: float) = obj.body.applyImpulse( vectorForAngle(obj.body.getAngle()).rperp()* obj.record.handling.strafe * dt, - vectorZero) + VectorZero) proc turn_right*(obj: PVehicle, dt: float) = #obj.angle = (obj.angle + (obj.record.handling.rotation.float / 10.0 * dt)) mod TAU obj.body.setTorque(obj.record.handling.rotation) diff --git a/tests/modules/tmismatchedvisibility.nim b/tests/modules/tmismatchedvisibility.nim index 6f2f79282..325c729c0 100644 --- a/tests/modules/tmismatchedvisibility.nim +++ b/tests/modules/tmismatchedvisibility.nim @@ -1,9 +1,9 @@ discard """ line: 8 - errormsg: "public implementation 'tmismatchedvisibility.foo(a: int): int' has non-public forward declaration in tmismatchedvisibility.nim(6,5)" + errormsg: "public implementation 'tmismatchedvisibility.foo(a: int)' has non-public forward declaration in " """ proc foo(a: int): int proc foo*(a: int): int = - result = a + a \ No newline at end of file + result = a + a diff --git a/tests/osproc/tstdin.nim b/tests/osproc/tstdin.nim index 2ea939992..b491c2500 100644 --- a/tests/osproc/tstdin.nim +++ b/tests/osproc/tstdin.nim @@ -4,13 +4,16 @@ discard """ """ import osproc, os, streams -doAssert fileExists(getCurrentDir() / "tests" / "osproc" / "ta.exe") +const filename = when defined(Windows): "ta.exe" else: "ta" -var p = startProcess("ta.exe", getCurrentDir() / "tests" / "osproc") +doAssert fileExists(getCurrentDir() / "tests" / "osproc" / filename) + +var p = startProcess(filename, getCurrentDir() / "tests" / "osproc") p.inputStream.write("5\n") +p.inputStream.flush() while true: let line = p.outputStream.readLine() if line != "": echo line else: - break \ No newline at end of file + break diff --git a/tests/static/tmatrix.nim b/tests/static/tmatrix.nim new file mode 100644 index 000000000..a143e2bc9 --- /dev/null +++ b/tests/static/tmatrix.nim @@ -0,0 +1,19 @@ +discard """ + output: "" +""" + +type Matrix[M,N: static[int]] = array[M, array[N, float]] + +let a = [[1.0, 1.0, 1.0, 1.0], + [2.0, 4.0, 8.0, 16.0], + [3.0, 9.0, 27.0, 81.0], + [4.0, 16.0, 64.0, 256.0]] + +proc `$`(m: Matrix): string = + result = "" + +proc `*`[M,N,M2,N2](a: Matrix[M,N2]; b: Matrix[M2,N]): Matrix[M,N] = + discard + +echo a * a + diff --git a/tests/stdlib/tdialogs.nim b/tests/stdlib/tdialogs.nim index d161a976d..f0203d319 100644 --- a/tests/stdlib/tdialogs.nim +++ b/tests/stdlib/tdialogs.nim @@ -4,7 +4,7 @@ import dialogs, gtk2 gtk2.nimrod_init() -var x = ChooseFilesToOpen(nil) +var x = chooseFilesToOpen(nil) for a in items(x): writeln(stdout, a) @@ -12,6 +12,6 @@ info(nil, "start with an info box") warning(nil, "now a warning ...") error(nil, "... and an error!") -writeln(stdout, ChooseFileToOpen(nil)) -writeln(stdout, ChooseFileToSave(nil)) -writeln(stdout, ChooseDir(nil)) +writeln(stdout, chooseFileToOpen(nil)) +writeln(stdout, chooseFileToSave(nil)) +writeln(stdout, chooseDir(nil)) diff --git a/tests/stdlib/tgetfileinfo.nim b/tests/stdlib/tgetfileinfo.nim index 49a019061..c8e496cc1 100644 --- a/tests/stdlib/tgetfileinfo.nim +++ b/tests/stdlib/tgetfileinfo.nim @@ -32,7 +32,7 @@ proc caseOneAndTwo(followLink: bool) = try: discard getFileInfo(getAppFilename(), followLink) #echo("String : Existing File : Symlink $# : Success" % $followLink) - except EOS: + except OSError: echo("String : Existing File : Symlink $# : Failure" % $followLink) proc caseThreeAndFour(followLink: bool) = @@ -40,7 +40,8 @@ proc caseThreeAndFour(followLink: bool) = try: discard getFileInfo(invalidName, true) echo("String : Non-existing File : Symlink $# : Failure" % $followLink) - except EOS: + except OSError: + discard #echo("String : Non-existing File : Symlink $# : Success" % $followLink) proc testGetFileInfo = @@ -82,12 +83,14 @@ proc testGetFileInfo = discard getFileInfo(testFile) echo("Handle : Invalid File : Failure") except EIO, EOS: + discard #echo("Handle : Invalid File : Success") try: discard getFileInfo(testHandle) echo("Handle : Invalid File : Failure") except EIO, EOS: + discard #echo("Handle : Invalid File : Success") -testGetFileInfo() \ No newline at end of file +testGetFileInfo() diff --git a/tests/stdlib/tircbot.nim b/tests/stdlib/tircbot.nim index b91300762..6b209dce3 100644 --- a/tests/stdlib/tircbot.nim +++ b/tests/stdlib/tircbot.nim @@ -2,7 +2,7 @@ import irc, sockets, asyncio, json, os, strutils, times, redis type TDb* = object - r*: TRedis + r*: Redis lastPing: float TBuildResult* = enum @@ -15,20 +15,20 @@ type TCommit* = object commitMsg*, username*, hash*: string - date*: TTime + date*: Time TPlatform* = object buildResult*: TBuildResult testResult*: TTestResult failReason*, platform*: string - total*, passed*, skipped*, failed*: biggestInt + total*, passed*, skipped*, failed*: BiggestInt csources*: bool const listName = "commits" - failOnExisting = False + failOnExisting = false -proc open*(host = "localhost", port: TPort): TDb = +proc open*(host = "localhost", port: Port): TDb = result.r = redis.open(host, port) result.lastPing = epochTime() @@ -80,7 +80,7 @@ proc getCommits*(database: TDb, for key, value in database.r.hPairs(c): case normalize(key) of "commitmsg": commit.commitMsg = value - of "date": commit.date = TTime(parseInt(value)) + of "date": commit.date = Time(parseInt(value)) of "username": commit.username = value else: echo(key) @@ -157,21 +157,21 @@ proc `[]`*(p: seq[TPlatform], name: string): TPlatform = for platform in items(p): if platform.platform == name: return platform - raise newException(EInvalidValue, name & " platforms not found in commits.") + raise newException(ValueError, name & " platforms not found in commits.") proc contains*(p: seq[TPlatform], s: string): bool = for i in items(p): if i.platform == s: - return True + return true type PState = ref TState - TState = object of TObject - dispatcher: PDispatcher - sock: PAsyncSocket + TState = object of RootObj + dispatcher: Dispatcher + sock: AsyncSocket ircClient: PAsyncIRC - hubPort: TPort + hubPort: Port database: TDb dbConnected: bool @@ -181,7 +181,7 @@ type TSeen = object nick: string channel: string - timestamp: TTime + timestamp: Time case kind*: TSeenType of PSeenJoin: nil of PSeenPart, PSeenQuit, PSeenMsg: @@ -218,11 +218,12 @@ proc getSeen(d: TDb, nick: string, s: var TSeen): bool = for key, value in d.r.hPairs("seen:" & nick): case normalize(key) of "type": + discard #s.kind = value.parseInt.TSeenType of "channel": s.channel = value of "timestamp": - s.timestamp = TTime(value.parseInt) + s.timestamp = Time(value.parseInt) of "msg": s.msg = value of "newnick": @@ -235,7 +236,7 @@ template createSeen(typ: TSeenType, n, c: string): stmt {.immediate, dirty.} = seenNick.channel = c seenNick.timestamp = getTime() -proc parseReply(line: string, expect: string): Bool = +proc parseReply(line: string, expect: string): bool = var jsonDoc = parseJson(line) return jsonDoc["reply"].str == expect @@ -272,14 +273,14 @@ proc handleWebMessage(state: PState, line: string) = message.add(limitCommitMsg(commit["message"].str)) # Send message to #nim. - state.ircClient.privmsg(joinChans[0], message) + discard state.ircClient.privmsg(joinChans[0], message) elif json.hasKey("redisinfo"): assert json["redisinfo"].hasKey("port") #let redisPort = json["redisinfo"]["port"].num state.dbConnected = true proc hubConnect(state: PState) -proc handleConnect(s: PAsyncSocket, state: PState) = +proc handleConnect(s: AsyncSocket, state: PState) = try: # Send greeting var obj = newJObject() @@ -295,7 +296,7 @@ proc handleConnect(s: PAsyncSocket, state: PState) = doAssert parseReply(line, "OK") echo("The hub accepted me!") else: - raise newException(EInvalidValue, + raise newException(ValueError, "Hub didn't accept me. Waited 1.5 seconds.") # ask for the redis info @@ -303,35 +304,35 @@ proc handleConnect(s: PAsyncSocket, state: PState) = riobj["do"] = newJString("redisinfo") state.sock.send($riobj & "\c\L") - except EOS: + except OsError: echo(getCurrentExceptionMsg()) s.close() echo("Waiting 5 seconds...") sleep(5000) state.hubConnect() -proc handleRead(s: PAsyncSocket, state: PState) = +proc handleRead(s: AsyncSocket, state: PState) = var line = "" if state.sock.recvLine(line): if line != "": # Handle the message state.handleWebMessage(line) else: - echo("Disconnected from hub: ", OSErrorMsg()) + echo("Disconnected from hub: ", osErrorMsg()) s.close() echo("Reconnecting...") state.hubConnect() else: - echo(OSErrorMsg()) + echo(osErrorMsg()) proc hubConnect(state: PState) = - state.sock = AsyncSocket() + state.sock = asyncSocket() state.sock.connect("127.0.0.1", state.hubPort) state.sock.handleConnect = - proc (s: PAsyncSocket) = + proc (s: AsyncSocket) = handleConnect(s, state) state.sock.handleRead = - proc (s: PAsyncSocket) = + proc (s: AsyncSocket) = handleRead(s, state) state.dispatcher.register(state.sock) @@ -426,7 +427,7 @@ proc handleIrc(irc: PAsyncIRC, event: TIRCEvent, state: PState) = else: discard # TODO: ? -proc open(port: TPort = TPort(5123)): PState = +proc open(port: Port = Port(5123)): PState = var res: PState new(res) res.dispatcher = newDispatcher() diff --git a/tests/template/tscope.nim b/tests/template/tscope.nim new file mode 100644 index 000000000..2d5841af3 --- /dev/null +++ b/tests/template/tscope.nim @@ -0,0 +1,12 @@ +discard """ + errormsg: "redefinition of 'x'" +""" + +var x = 1 +template quantity(): stmt {.immediate.} = + # Causes internal error in compiler/sem.nim + proc unit*(x = 1.0): float = 12 + # Throws the correct error: redefinition of 'x' + #proc unit*(y = 1.0): float = 12 +quantity() +var x = 2 diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim index 5cd5c1545..54e962693 100644 --- a/tests/testament/categories.nim +++ b/tests/testament/categories.nim @@ -330,8 +330,9 @@ proc `&?.`(a, b: string): string = proc processCategory(r: var TResults, cat: Category, options: string) = case cat.string.normalize of "rodfiles": - compileRodFiles(r, cat, options) - runRodFiles(r, cat, options) + discard # Disabled for now + #compileRodFiles(r, cat, options) + #runRodFiles(r, cat, options) of "js": # XXX JS doesn't need to be special anymore jsTests(r, cat, options) diff --git a/tests/testament/tester.nim b/tests/testament/tester.nim index 865ba9c75..45643be10 100644 --- a/tests/testament/tester.nim +++ b/tests/testament/tester.nim @@ -134,7 +134,7 @@ proc cmpMsgs(r: var TResults, expected, given: TSpec, test: TTest) = proc generatedFile(path, name: string, target: TTarget): string = let ext = targetToExt[target] result = path / "nimcache" / - (if target == targetJS: path.splitPath.tail & "_" else: "") & + (if target == targetJS: path.splitPath.tail & "_" else: "compiler_") & name.changeFileExt(ext) proc codegenCheck(test: TTest, check: string, given: var TSpec) = |