Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Gallant (Ocelot) authored and Andrew Gallant (Ocelot) committed May 7, 2012
1 parent 26191c0 commit 902f3ad
Show file tree
Hide file tree
Showing 33 changed files with 1,256 additions and 256 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ all: bigreq.xml composite.xml damage.xml dpms.xml dri2.xml \
%.xml:
xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/$*.xml > auto_$*.go

test:
go test

bench:
go test -run 'nomatch' -bench '.*' -cpu 1,2,6

26 changes: 25 additions & 1 deletion auto_bigreq.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
package xgb

/*
This file was generated by bigreq.xml on May 6 2012 3:00:43am EDT.
This file was generated by bigreq.xml on May 6 2012 5:48:46pm EDT.
This file is automatically generated. Edit at your peril!
*/

// BigreqInit must be called before using the BIG-REQUESTS extension.
func (c *Conn) BigreqInit() error {
reply, err := c.QueryExtension(12, "BIG-REQUESTS").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return newError("No extension named BIG-REQUESTS could be found on on the server.")
}

c.extLock.Lock()
c.extensions["BIG-REQUESTS"] = reply.MajorOpcode
for evNum, fun := range newExtEventFuncs["BIG-REQUESTS"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
c.extLock.Unlock()

return nil
}

func init() {
newExtEventFuncs["BIG-REQUESTS"] = make(map[int]newEventFun)
}

// Skipping definition for base type 'Float'

// Skipping definition for base type 'Id'
Expand Down
38 changes: 31 additions & 7 deletions auto_composite.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xgb

/*
This file was generated by composite.xml on May 6 2012 3:00:43am EDT.
This file was generated by composite.xml on May 6 2012 5:48:46pm EDT.
This file is automatically generated. Edit at your peril!
*/

Expand All @@ -10,15 +10,29 @@ package xgb
// import "xproto"
// import "xfixes"

// Skipping definition for base type 'Float'

// Skipping definition for base type 'Id'
// CompositeInit must be called before using the Composite extension.
func (c *Conn) CompositeInit() error {
reply, err := c.QueryExtension(9, "Composite").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return newError("No extension named Composite could be found on on the server.")
}

// Skipping definition for base type 'Card8'
c.extLock.Lock()
c.extensions["Composite"] = reply.MajorOpcode
for evNum, fun := range newExtEventFuncs["Composite"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
c.extLock.Unlock()

// Skipping definition for base type 'Int16'
return nil
}

// Skipping definition for base type 'Int32'
func init() {
newExtEventFuncs["Composite"] = make(map[int]newEventFun)
}

// Skipping definition for base type 'Void'

Expand All @@ -36,6 +50,16 @@ package xgb

// Skipping definition for base type 'Bool'

// Skipping definition for base type 'Float'

// Skipping definition for base type 'Id'

// Skipping definition for base type 'Card8'

// Skipping definition for base type 'Int16'

// Skipping definition for base type 'Int32'

const (
CompositeRedirectAutomatic = 0
CompositeRedirectManual = 1
Expand Down
36 changes: 30 additions & 6 deletions auto_damage.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package xgb

/*
This file was generated by damage.xml on May 6 2012 3:00:43am EDT.
This file was generated by damage.xml on May 6 2012 5:48:47pm EDT.
This file is automatically generated. Edit at your peril!
*/

Expand All @@ -10,13 +10,29 @@ package xgb
// import "xproto"
// import "xfixes"

// Skipping definition for base type 'Card16'
// DamageInit must be called before using the DAMAGE extension.
func (c *Conn) DamageInit() error {
reply, err := c.QueryExtension(6, "DAMAGE").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return newError("No extension named DAMAGE could be found on on the server.")
}

// Skipping definition for base type 'Char'
c.extLock.Lock()
c.extensions["DAMAGE"] = reply.MajorOpcode
for evNum, fun := range newExtEventFuncs["DAMAGE"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
c.extLock.Unlock()

// Skipping definition for base type 'Card32'
return nil
}

// Skipping definition for base type 'Double'
func init() {
newExtEventFuncs["DAMAGE"] = make(map[int]newEventFun)
}

// Skipping definition for base type 'Bool'

Expand All @@ -36,6 +52,14 @@ package xgb

// Skipping definition for base type 'Int8'

// Skipping definition for base type 'Card16'

// Skipping definition for base type 'Char'

// Skipping definition for base type 'Card32'

// Skipping definition for base type 'Double'

const (
DamageReportLevelRawRectangles = 0
DamageReportLevelDeltaRectangles = 1
Expand Down Expand Up @@ -144,7 +168,7 @@ func (v DamageNotifyEvent) String() string {
}

func init() {
newEventFuncs[0] = NewDamageNotifyEvent
newExtEventFuncs["DAMAGE"][0] = NewDamageNotifyEvent
}

// Error definition DamageBadDamage (0)
Expand Down
30 changes: 27 additions & 3 deletions auto_dpms.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
package xgb

/*
This file was generated by dpms.xml on May 6 2012 3:00:44am EDT.
This file was generated by dpms.xml on May 6 2012 5:48:47pm EDT.
This file is automatically generated. Edit at your peril!
*/

// DpmsInit must be called before using the DPMS extension.
func (c *Conn) DpmsInit() error {
reply, err := c.QueryExtension(4, "DPMS").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return newError("No extension named DPMS could be found on on the server.")
}

c.extLock.Lock()
c.extensions["DPMS"] = reply.MajorOpcode
for evNum, fun := range newExtEventFuncs["DPMS"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
c.extLock.Unlock()

return nil
}

func init() {
newExtEventFuncs["DPMS"] = make(map[int]newEventFun)
}

// Skipping definition for base type 'Int32'

// Skipping definition for base type 'Void'

// Skipping definition for base type 'Byte'
Expand All @@ -29,8 +55,6 @@ package xgb

// Skipping definition for base type 'Int16'

// Skipping definition for base type 'Int32'

const (
DpmsDPMSModeOn = 0
DpmsDPMSModeStandby = 1
Expand Down
30 changes: 27 additions & 3 deletions auto_dri2.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
package xgb

/*
This file was generated by dri2.xml on May 6 2012 3:00:44am EDT.
This file was generated by dri2.xml on May 6 2012 5:48:47pm EDT.
This file is automatically generated. Edit at your peril!
*/

// Imports are not necessary for XGB because everything is
// in one package. They are still listed here for reference.
// import "xproto"

// Dri2Init must be called before using the DRI2 extension.
func (c *Conn) Dri2Init() error {
reply, err := c.QueryExtension(4, "DRI2").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return newError("No extension named DRI2 could be found on on the server.")
}

c.extLock.Lock()
c.extensions["DRI2"] = reply.MajorOpcode
for evNum, fun := range newExtEventFuncs["DRI2"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
c.extLock.Unlock()

return nil
}

func init() {
newExtEventFuncs["DRI2"] = make(map[int]newEventFun)
}

// Skipping definition for base type 'Float'

// Skipping definition for base type 'Id'
Expand Down Expand Up @@ -306,7 +330,7 @@ func (v Dri2BufferSwapCompleteEvent) String() string {
}

func init() {
newEventFuncs[0] = NewDri2BufferSwapCompleteEvent
newExtEventFuncs["DRI2"][0] = NewDri2BufferSwapCompleteEvent
}

// Event definition Dri2InvalidateBuffers (1)
Expand Down Expand Up @@ -369,7 +393,7 @@ func (v Dri2InvalidateBuffersEvent) String() string {
}

func init() {
newEventFuncs[1] = NewDri2InvalidateBuffersEvent
newExtEventFuncs["DRI2"][1] = NewDri2InvalidateBuffersEvent
}

// Request Dri2QueryVersion
Expand Down
34 changes: 29 additions & 5 deletions auto_ge.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
package xgb

/*
This file was generated by ge.xml on May 6 2012 3:00:44am EDT.
This file was generated by ge.xml on May 6 2012 5:48:47pm EDT.
This file is automatically generated. Edit at your peril!
*/

// Skipping definition for base type 'Id'
// GeInit must be called before using the Generic Event Extension extension.
func (c *Conn) GeInit() error {
reply, err := c.QueryExtension(23, "Generic Event Extension").Reply()
switch {
case err != nil:
return err
case !reply.Present:
return newError("No extension named Generic Event Extension could be found on on the server.")
}

// Skipping definition for base type 'Card8'
c.extLock.Lock()
c.extensions["Generic Event Extension"] = reply.MajorOpcode
for evNum, fun := range newExtEventFuncs["Generic Event Extension"] {
newEventFuncs[int(reply.FirstEvent)+evNum] = fun
}
c.extLock.Unlock()

// Skipping definition for base type 'Int16'
return nil
}

// Skipping definition for base type 'Int32'
func init() {
newExtEventFuncs["Generic Event Extension"] = make(map[int]newEventFun)
}

// Skipping definition for base type 'Void'

Expand All @@ -31,6 +47,14 @@ package xgb

// Skipping definition for base type 'Float'

// Skipping definition for base type 'Id'

// Skipping definition for base type 'Card8'

// Skipping definition for base type 'Int16'

// Skipping definition for base type 'Int32'

// Request GeQueryVersion
// size: 8
type GeQueryVersionCookie struct {
Expand Down
Loading

0 comments on commit 902f3ad

Please sign in to comment.