Skip to content

Instantly share code, notes, and snippets.

@jspahrsummers
Created June 20, 2012 01:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jspahrsummers/2957578 to your computer and use it in GitHub Desktop.
Save jspahrsummers/2957578 to your computer and use it in GitHub Desktop.
#1 "Tests/EXTADTTest.m"
#1 "Tests/EXTADTTest.m" 1
#1 "<built-in>" 1
#1 "<built-in>" 3
#152 "<built-in>" 3
#1 "<command line>" 1
#1 "<built-in>" 2
#1 "Tests/EXTADTTest.m" 2
#1 "Tests/EXTADTTest.h" 1
#10 "Tests/EXTADTTest.h"
#1 "Modules/EXTADT.h" 1
#1 "./metamacros.h" 1
#10 "Modules/EXTADT.h" 2
#11 "Tests/EXTADTTest.h" 2
@ interface EXTADTTest:SenTestCase
@ end
#10 "Tests/EXTADTTest.m" 2
typedef unsigned char Red_unused__junk_17, _ADT_17_Red_aliases0;
typedef unsigned char Green_unused__junk_17, _ADT_17_Green_aliases0;
typedef unsigned char Blue_unused__junk_17, _ADT_17_Blue_aliases0;
typedef double alpha_junk_17, _ADT_17_Gray_aliases0;
typedef unsigned char Gray_unused__junk_17, _ADT_17_Gray_aliases1;
typedef double r_junk_17, _ADT_17_Other_aliases0;
typedef double g_junk_17, _ADT_17_Other_aliases1;
typedef double b_junk_17, _ADT_17_Other_aliases2;
typedef unsigned char Other_unused__junk_17, _ADT_17_Other_aliases3;
typedef struct _ADT_17
{
void *tag;
union
{
struct
{
unsigned char Red_unused_;
};
struct _ADT_17_Red_aliases
{
_ADT_17_Red_aliases0 v0;
} Red;
struct
{
unsigned char Green_unused_;
};
struct _ADT_17_Green_aliases
{
_ADT_17_Green_aliases0 v0;
} Green;
struct
{
unsigned char Blue_unused_;
};
struct _ADT_17_Blue_aliases
{
_ADT_17_Blue_aliases0 v0;
} Blue;
struct
{
double alpha;
unsigned char Gray_unused_;
};
struct _ADT_17_Gray_aliases
{
_ADT_17_Gray_aliases0 v0;
_ADT_17_Gray_aliases1 v1;
} Gray;
struct
{
double r;
double g;
double b;
unsigned char Other_unused_;
};
struct _ADT_17_Other_aliases
{
_ADT_17_Other_aliases0 v0;
_ADT_17_Other_aliases1 v1;
_ADT_17_Other_aliases2 v2;
_ADT_17_Other_aliases3 v3;
} Other;
};
} Color;
static inline struct _ADT_17
Red()
{
struct _ADT_17 s;
s.tag = (__typeof__(s.tag)) & Red;
struct _ADT_17_Red_aliases *entry __attribute__((unused)) = &s.Red;
return s;
} static inline struct _ADT_17
Green()
{
struct _ADT_17 s;
s.tag = (__typeof__(s.tag)) & Green;
struct _ADT_17_Green_aliases *entry __attribute__((unused)) = &s.Green;
return s;
} static inline struct _ADT_17
Blue()
{
struct _ADT_17 s;
s.tag = (__typeof__(s.tag)) & Blue;
struct _ADT_17_Blue_aliases *entry __attribute__((unused)) = &s.Blue;
return s;
} static inline struct _ADT_17
Gray(_ADT_17_Gray_aliases0 v0)
{
struct _ADT_17 s;
s.tag = (__typeof__(s.tag)) & Gray;
struct _ADT_17_Gray_aliases *entry __attribute__((unused)) = &s.Gray;
entry->v0 = v0;
return s;
} static inline struct _ADT_17
Other(_ADT_17_Other_aliases0 v0, _ADT_17_Other_aliases1 v1, _ADT_17_Other_aliases2 v2)
{
struct _ADT_17 s;
s.tag = (__typeof__(s.tag)) & Other;
struct _ADT_17_Other_aliases *entry __attribute__((unused)) = &s.Other;
entry->v0 = v0;
entry->v1 = v1;
entry->v2 = v2;
return s;
};
@implementation EXTADTTest
- (void)testConstruction
{
Color c1 = Red();
STAssertTrue(c1.tag == Red, @"");
Color c2 = Other(1.0, 0.5, 0.25);
STAssertTrue(c2.tag == Other, @"");
STAssertEqualsWithAccuracy(c2.r, 1.0, 0.0001, @"");
STAssertEqualsWithAccuracy(c2.g, 0.5, 0.0001, @"");
STAssertEqualsWithAccuracy(c2.b, 0.25, 0.0001, @"");
Color c3 = Gray(0.75);
STAssertTrue(c3.tag == Gray, @"");
STAssertEqualsWithAccuracy(c3.alpha, 0.75, 0.0001, @"");
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment