Add more structure constructor tests.
[piglit/hramrach.git] / tests / glean / tpgos.h
blob8919756ee3250c58623f66c4390a1faf358619d4
1 // BEGIN_COPYRIGHT -*- glean -*-
2 //
3 // Copyright (C) 1999 Allen Akin All Rights Reserved.
4 //
5 // Permission is hereby granted, free of charge, to any person
6 // obtaining a copy of this software and associated documentation
7 // files (the "Software"), to deal in the Software without
8 // restriction, including without limitation the rights to use,
9 // copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following
12 // conditions:
13 //
14 // The above copyright notice and this permission notice shall be
15 // included in all copies or substantial portions of the
16 // Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 // KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ALLEN AKIN BE
22 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
26 //
27 // END_COPYRIGHT
30 // tpgos.h: Polygon offset tests.
31 // Derived in part from tests written by Angus Dorbie <dorbie@sgi.com>
32 // in September 2000 and Rickard E. (Rik) Faith <faith@valinux.com> in
33 // October 2000.
35 #ifndef __tpgos_h__
36 #define __tpgos_h__
38 #include "tbase.h"
39 #include <iomanip>
41 namespace GLEAN {
43 // Auxiliary struct for holding a glPolygonOffset result
44 class POResult: public BaseResult {
45 public:
46 bool pass;
47 double nextToNear;
48 double nextToFar;
49 double idealMRDNear;
50 double idealMRDFar;
51 double actualMRDNear;
52 double actualMRDFar;
53 bool bigEnoughMRD;
54 bool smallEnoughMRD;
55 bool slopeOffsetsPassed;
56 float failingAngle;
57 float failingAxis[3];
58 double failingOffset;
59 double minGoodOffset;
60 double maxGoodOffset;
62 POResult() {
63 pass = true;
64 nextToNear = 1.0;
65 nextToFar = 2.0;
66 idealMRDNear = 0.1;
67 idealMRDFar = 0.1;
68 actualMRDNear = 0.1;
69 actualMRDFar = 0.1;
70 bigEnoughMRD = true;
71 smallEnoughMRD = true;
72 slopeOffsetsPassed = true;
73 failingAngle = 0.0;
74 failingAxis[0] = failingAxis[1] = failingAxis[2] = 0.0;
75 failingOffset = 1.0;
76 minGoodOffset = 0.1;
77 maxGoodOffset = 0.1;
80 void putresults(ostream& s) const {
81 s << setprecision(16)
82 << pass << '\n'
83 << nextToNear << ' ' << nextToFar << '\n'
84 << idealMRDNear << ' ' << idealMRDFar << '\n'
85 << actualMRDNear << ' ' << actualMRDFar << '\n'
86 << bigEnoughMRD << ' ' << smallEnoughMRD << '\n'
87 << slopeOffsetsPassed << '\n'
88 << failingAngle << '\n'
89 << failingAxis[0] << ' ' << failingAxis[1] << ' '
90 << failingAxis[2] << '\n'
91 << failingOffset << ' ' << minGoodOffset << ' '
92 << maxGoodOffset << '\n'
96 bool getresults(istream& s) {
97 s >> pass
98 >> nextToNear
99 >> nextToFar
100 >> idealMRDNear
101 >> idealMRDFar
102 >> actualMRDNear
103 >> actualMRDFar
104 >> bigEnoughMRD
105 >> smallEnoughMRD
106 >> slopeOffsetsPassed
107 >> failingAngle
108 >> failingAxis[0] >> failingAxis[1] >> failingAxis[2]
109 >> failingOffset >> minGoodOffset >> maxGoodOffset
111 return s.good();
115 #define PGOS_WIN_SIZE 128
117 class PgosTest: public BaseTest<POResult> {
118 public:
119 GLEAN_CLASS_WH(PgosTest, POResult, PGOS_WIN_SIZE, PGOS_WIN_SIZE);
120 }; // class PgosTest
122 } // namespace GLEAN
124 #endif // __tpgos_h__