diff options
Diffstat (limited to 'src/junit/com')
5 files changed, 266 insertions, 68 deletions
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java index b5f4f2c..db8c157 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/BaseClass.java @@ -98,63 +98,6 @@ public class BaseClass extends SingletonJunitCase { AnonBlob ab = null; PointerBuffer pb=null; - // Test constants values: binding and value! - { - // Plain vanilla CPP constants - Assert.assertEquals( 1, Bindingtest1.CONSTANT_ONE); - Assert.assertEquals( 8, Bindingtest1.ARRAY_SIZE); - Assert.assertEquals(1234, Bindingtest1.DEFINE_01); - - // Enums - Assert.assertEquals( 1, Bindingtest1.LI); - Assert.assertEquals( 3, Bindingtest1.LO); - Assert.assertEquals( 2, Bindingtest1.LU); - Assert.assertEquals( 1, Bindingtest1.MI); - Assert.assertEquals( 3, Bindingtest1.MO); - Assert.assertEquals( 2, Bindingtest1.MU); - Assert.assertEquals( 0, Bindingtest1.ZERO); - Assert.assertEquals( 1, Bindingtest1.ONE); - Assert.assertEquals( 2, Bindingtest1.TWO); - Assert.assertEquals( 3, Bindingtest1.THREE); - - // CPP Macro Expansion! - Assert.assertEquals( 1, Bindingtest1.NUMBER_ONE); - Assert.assertEquals( 2, Bindingtest1.NUMBER_TWO); - Assert.assertEquals( 4, Bindingtest1.NUMBER_FOUR); - Assert.assertEquals( 8, Bindingtest1.NUMBER_EIGHT); - Assert.assertEquals( 9, Bindingtest1.NUMBER_NINE); - Assert.assertEquals( 10, Bindingtest1.NUMBER_TEN); - - - // Floating point hexadecimals - final float CL_FLT_A0 = Bindingtest1.CL_FLT_A0; - final float CL_FLT_A1 = Bindingtest1.CL_FLT_A1; - final float CL_FLT_A2 = Bindingtest1.CL_FLT_A2; - Assert.assertEquals( 0x1.p127f, CL_FLT_A0, EPSILON); - Assert.assertEquals( 0x1.p+127F, CL_FLT_A1, EPSILON); - Assert.assertEquals( 0x1.p-127f, CL_FLT_A2, EPSILON); - - final float CL_FLT_EPSILON = Bindingtest1.CL_FLT_EPSILON; - final double CL_FLT_MAX= Bindingtest1.CL_FLT_MAX; - final double CL_FLT_MIN = Bindingtest1.CL_FLT_MIN; - Assert.assertEquals( 0x1.0p-23f, CL_FLT_EPSILON, EPSILON); - Assert.assertEquals( 0x1.fffffep127f, CL_FLT_MAX, EPSILON); - Assert.assertEquals( 0x1.0p-126f, CL_FLT_MIN, EPSILON); - - final double CL_DBL_B0 = Bindingtest1.CL_DBL_B0; - final double CL_DBL_B1 = Bindingtest1.CL_DBL_B1; - final double CL_DBL_B2 = Bindingtest1.CL_DBL_B2; - Assert.assertEquals( 0x1.p127d, CL_DBL_B0, EPSILON); - Assert.assertEquals( 0x1.p+127D, CL_DBL_B1, EPSILON); - Assert.assertEquals( 0x1.p-127d, CL_DBL_B2, EPSILON); - - final float CL_DBL_EPSILON = Bindingtest1.CL_DBL_EPSILON; - final double CL_DBL_MAX= Bindingtest1.CL_DBL_MAX; - final double CL_DBL_MIN = Bindingtest1.CL_DBL_MIN; - Assert.assertEquals( 0x1.0p-52f, CL_DBL_EPSILON, EPSILON); - Assert.assertEquals( 0x1.fffffffffffffp1023, CL_DBL_MAX, EPSILON); - Assert.assertEquals( 0x1.0p-1022, CL_DBL_MIN, EPSILON); - } { l = binding.testXID(l); l = binding.testXID_2(l); @@ -267,6 +210,185 @@ public class BaseClass extends SingletonJunitCase { l = binding.typeTestUIntPtrT(l, l); } + /** + * Verifies if all generated static constant values are completed, + * and whether their value is as expected! + * <p> + * Covers all enumerates and defines. + * </p> + */ + public void chapter01TestStaticConstants(final Bindingtest1 binding) throws Exception { + // Plain vanilla CPP constants + Assert.assertEquals( 1, Bindingtest1.CONSTANT_ONE); + Assert.assertEquals( 8, Bindingtest1.ARRAY_SIZE); + Assert.assertEquals(1234, Bindingtest1.DEFINE_01); + + // Enums + Assert.assertEquals( 1, Bindingtest1.LI); + Assert.assertEquals( 3, Bindingtest1.LO); + Assert.assertEquals( 2, Bindingtest1.LU); + Assert.assertEquals( 1, Bindingtest1.MI); + Assert.assertEquals( 3, Bindingtest1.MO); + Assert.assertEquals( 2, Bindingtest1.MU); + Assert.assertEquals( 0, Bindingtest1.ZERO); + Assert.assertEquals( 1, Bindingtest1.ONE); + Assert.assertEquals( 2, Bindingtest1.TWO); + Assert.assertEquals( 3, Bindingtest1.THREE); + + // CPP Macro Expansion! + Assert.assertEquals( 1, Bindingtest1.NUMBER_ONE); + Assert.assertEquals( 2, Bindingtest1.NUMBER_TWO); + Assert.assertEquals( 4, Bindingtest1.NUMBER_FOUR); + Assert.assertEquals( 5, Bindingtest1.NUMBER_FIVE); + Assert.assertEquals( 8, Bindingtest1.NUMBER_EIGHT); + Assert.assertEquals( 9, Bindingtest1.NUMBER_NINE); + Assert.assertEquals( 10, Bindingtest1.NUMBER_TEN); + + // Enum Constant Expressions! + Assert.assertEquals( 1, Bindingtest1.ENUM_NUM_ONE); + Assert.assertEquals( 2, Bindingtest1.ENUM_NUM_TWO); + Assert.assertEquals( 3, Bindingtest1.ENUM_NUM_THREE); + Assert.assertEquals( 4, Bindingtest1.ENUM_NUM_FOUR); + Assert.assertEquals( 5, Bindingtest1.ENUM_NUM_FIVE); + Assert.assertEquals( 8, Bindingtest1.ENUM_NUM_EIGHT); + Assert.assertEquals( 9, Bindingtest1.ENUM_NUM_NINE); + Assert.assertEquals( 10, Bindingtest1.ENUM_NUM_TEN); + + // Integer 32bit (int / enum) + final int ENUM_I0 = Bindingtest1.ENUM_I0; + final int ENUM_I1 = Bindingtest1.ENUM_I1; + final int ENUM_I2 = Bindingtest1.ENUM_I2; + final int ENUM_I3 = Bindingtest1.ENUM_I3; + final int ENUM_I4 = -Bindingtest1.ENUM_I4; + final int ENUM_I5 = -Bindingtest1.ENUM_I5; + final int ENUM_I6 = -Bindingtest1.ENUM_I6; + final int ENUM_I7 = Bindingtest1.ENUM_I7; + final int ENUM_I8 = Bindingtest1.ENUM_I8; + final int ENUM_I9 = Bindingtest1.ENUM_I9; + final int ENUM_IA = Bindingtest1.ENUM_IA; + final int ENUM_IB = Bindingtest1.ENUM_IB; + final int ENUM_IX = Bindingtest1.ENUM_IX; + int iexp = 10; + Assert.assertEquals(iexp++, ENUM_I0); + Assert.assertEquals(iexp++, ENUM_I1); + Assert.assertEquals(iexp++, ENUM_I2); + Assert.assertEquals(iexp++, ENUM_I3); + Assert.assertEquals(iexp++, ENUM_I4); + Assert.assertEquals(iexp++, ENUM_I5); + Assert.assertEquals(iexp++, ENUM_I6); + Assert.assertEquals(iexp++, ENUM_I7); + Assert.assertEquals(iexp++, ENUM_I8); + Assert.assertEquals(iexp++, ENUM_I9); + Assert.assertEquals(iexp++, ENUM_IA); + Assert.assertEquals(iexp++, ENUM_IB); + Assert.assertEquals(0xffffffff, ENUM_IX); + + // Integer 32bit (int / define) + final int CL_INT_I0 = Bindingtest1.CL_INT_I0; + final int CL_INT_I1 = Bindingtest1.CL_INT_I1; + final int CL_INT_I2 = Bindingtest1.CL_INT_I2; + final int CL_INT_I3 = Bindingtest1.CL_INT_I3; + final int CL_INT_I4 = -Bindingtest1.CL_INT_I4; + final int CL_INT_I5 = -Bindingtest1.CL_INT_I5; + final int CL_INT_I6 = -Bindingtest1.CL_INT_I6; + final int CL_INT_I7 = -Bindingtest1.CL_INT_I7; + final int CL_INT_I8 = Bindingtest1.CL_INT_I8; + final int CL_INT_I9 = Bindingtest1.CL_INT_I9; + final int CL_INT_IA = Bindingtest1.CL_INT_IA; + final int CL_INT_IB = Bindingtest1.CL_INT_IB; + final int CL_INT_IX = Bindingtest1.CL_INT_IX; + iexp = 10; + Assert.assertEquals(iexp++, CL_INT_I0); + Assert.assertEquals(iexp++, CL_INT_I1); + Assert.assertEquals(iexp++, CL_INT_I2); + Assert.assertEquals(iexp++, CL_INT_I3); + Assert.assertEquals(iexp++, CL_INT_I4); + Assert.assertEquals(iexp++, CL_INT_I5); + Assert.assertEquals(iexp++, CL_INT_I6); + Assert.assertEquals(iexp++, CL_INT_I7); + Assert.assertEquals(iexp++, CL_INT_I8); + Assert.assertEquals(iexp++, CL_INT_I9); + Assert.assertEquals(iexp++, CL_INT_IA); + Assert.assertEquals(iexp++, CL_INT_IB); + Assert.assertEquals(0xffffffff, CL_INT_IX); + + // Integer 64bit (long / define ) + final long CL_LNG_L0 = Bindingtest1.CL_LNG_L0; + final long CL_LNG_L1 = Bindingtest1.CL_LNG_L1; + final long CL_LNG_L2 = Bindingtest1.CL_LNG_L2; + final long CL_LNG_L3 = Bindingtest1.CL_LNG_L3; + final long CL_LNG_L4 = -Bindingtest1.CL_LNG_L4; + final long CL_LNG_L5 = -Bindingtest1.CL_LNG_L5; + final long CL_LNG_L6 = -Bindingtest1.CL_LNG_L6; + final long CL_LNG_L7 = -Bindingtest1.CL_LNG_L7; + final long CL_LNG_L8 = Bindingtest1.CL_LNG_L8; + final long CL_LNG_L9 = Bindingtest1.CL_LNG_L9; + final long CL_LNG_LA = Bindingtest1.CL_LNG_LA; + final long CL_LNG_LB = Bindingtest1.CL_LNG_LB; + final long CL_LNG_LX = Bindingtest1.CL_LNG_LX; + long lexp = 2147483648L; + Assert.assertEquals(lexp++, CL_LNG_L0); + Assert.assertEquals(lexp++, CL_LNG_L1); + Assert.assertEquals(lexp++, CL_LNG_L2); + Assert.assertEquals(lexp++, CL_LNG_L3); + Assert.assertEquals(lexp++, CL_LNG_L4); + Assert.assertEquals(lexp++, CL_LNG_L5); + Assert.assertEquals(lexp++, CL_LNG_L6); + Assert.assertEquals(lexp++, CL_LNG_L7); + Assert.assertEquals(lexp++, CL_LNG_L8); + Assert.assertEquals(lexp++, CL_LNG_L9); + Assert.assertEquals(lexp++, CL_LNG_LA); + Assert.assertEquals(lexp++, CL_LNG_LB); + Assert.assertEquals(0xffffffffffffffffL, CL_LNG_LX); + + // Floating point hexadecimals + final float CL_FLT_A0 = Bindingtest1.CL_FLT_A0; + final float CL_FLT_A1 = Bindingtest1.CL_FLT_A1; + final float CL_FLT_A2 = Bindingtest1.CL_FLT_A2; + final float CL_FLT_A3 = Bindingtest1.CL_FLT_A3; + final float CL_FLT_A4 = Bindingtest1.CL_FLT_A4; + final float CL_FLT_A5 = Bindingtest1.CL_FLT_A5; + final float CL_FLT_A6 = Bindingtest1.CL_FLT_A6; + final float CL_FLT_A7 = Bindingtest1.CL_FLT_A7; + Assert.assertEquals( 0x1.p127f, CL_FLT_A0, EPSILON); + Assert.assertEquals( 0x1.p+127F, CL_FLT_A1, EPSILON); + Assert.assertEquals( 0x1.p-127f, CL_FLT_A2, EPSILON); + Assert.assertEquals( -0.1f, CL_FLT_A3, EPSILON); + Assert.assertEquals( 0.2f, CL_FLT_A4, EPSILON); + Assert.assertEquals( 0.3f, CL_FLT_A5, EPSILON); + Assert.assertEquals( 0.4f, CL_FLT_A6, EPSILON); + Assert.assertEquals( 1.0f, CL_FLT_A7, EPSILON); + + final float CL_FLT_EPSILON = Bindingtest1.CL_FLT_EPSILON; + final double CL_FLT_MAX= Bindingtest1.CL_FLT_MAX; + final double CL_FLT_MIN = Bindingtest1.CL_FLT_MIN; + Assert.assertEquals( 0x1.0p-23f, CL_FLT_EPSILON, EPSILON); + Assert.assertEquals( 0x1.fffffep127f, CL_FLT_MAX, EPSILON); + Assert.assertEquals( 0x1.0p-126f, CL_FLT_MIN, EPSILON); + + final double CL_DBL_B0 = Bindingtest1.CL_DBL_B0; + final double CL_DBL_B1 = Bindingtest1.CL_DBL_B1; + final double CL_DBL_B2 = Bindingtest1.CL_DBL_B2; + final double CL_DBL_B3 = Bindingtest1.CL_DBL_B3; + final double CL_DBL_B4 = Bindingtest1.CL_DBL_B4; + final double CL_DBL_B5 = Bindingtest1.CL_DBL_B5; + final double CL_DBL_B6 = Bindingtest1.CL_DBL_B6; + Assert.assertEquals( 0x1.p127d, CL_DBL_B0, EPSILON); + Assert.assertEquals( 0x1.p+127D, CL_DBL_B1, EPSILON); + Assert.assertEquals( 0x1.p-127d, CL_DBL_B2, EPSILON); + Assert.assertEquals( -0.1, CL_DBL_B3, EPSILON); + Assert.assertEquals( 0.2, CL_DBL_B4, EPSILON); + Assert.assertEquals( 0.3, CL_DBL_B5, EPSILON); + Assert.assertEquals( 3.5e+38, CL_DBL_B6, EPSILON); + + final float CL_DBL_EPSILON = Bindingtest1.CL_DBL_EPSILON; + final double CL_DBL_MAX= Bindingtest1.CL_DBL_MAX; + final double CL_DBL_MIN = Bindingtest1.CL_DBL_MIN; + Assert.assertEquals( 0x1.0p-52f, CL_DBL_EPSILON, EPSILON); + Assert.assertEquals( 0x1.fffffffffffffp1023, CL_DBL_MAX, EPSILON); + Assert.assertEquals( 0x1.0p-1022, CL_DBL_MIN, EPSILON); + } + ByteBuffer newByteBuffer(final int size, final boolean direct) { if(direct) { final ByteBuffer bb = Buffers.newDirectByteBuffer(size); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java index 9e961cb..5809acf 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java @@ -50,7 +50,7 @@ public class Test1p1JavaEmitter extends BaseClass { * Verifies loading of the new library. */ @BeforeClass - public static void chapter01TestLoadLibrary() throws Exception { + public static void chapter__TestLoadLibrary() throws Exception { BindingJNILibLoader.loadBindingtest1p1(); } @@ -58,7 +58,7 @@ public class Test1p1JavaEmitter extends BaseClass { * Verifies the existence and creation of the generated class. */ @Test - public void chapter02TestClassExist() throws Exception { + public void chapter00TestClassExist() throws Exception { testClassExist("test1p1"); } @@ -71,6 +71,18 @@ public class Test1p1JavaEmitter extends BaseClass { } /** + * Verifies if all generated static constant values are completed, + * and whether their value is as expected! + * <p> + * Covers all enumerates and defines. + * </p> + */ + @Test + public void chapter01TestStaticConstants() throws Exception { + chapter01TestStaticConstants(new Bindingtest1p1Impl()); + } + + /** * Verifies if all methods / signatures are properly generated, * can be invoked and functions. * This is a compilation (coverage) and runtime time (semantic) test. diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java index b8adab0..701342f 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2LoadJNIAndImplLib.java @@ -46,7 +46,7 @@ public class Test1p2LoadJNIAndImplLib extends BaseClass { * Verifies loading of the new library. */ @BeforeClass - public static void chapter01TestLoadLibrary() throws Exception { + public static void chapter__TestLoadLibrary() throws Exception { BindingJNILibLoader.loadBindingtest1p2(); dynamicLookupHelper = NativeLibrary.open("test1", Test1p2LoadJNIAndImplLib.class.getClassLoader(), true); Assert.assertNotNull("NativeLibrary.open(test1) failed", dynamicLookupHelper); @@ -58,17 +58,16 @@ public class Test1p2LoadJNIAndImplLib extends BaseClass { * Verifies the existence and creation of the generated class. */ @Test - public void chapter02TestClassExist() throws Exception { + public void chapter00TestClassExist() throws Exception { testClassExist("test1p2"); } - @SuppressWarnings("unused") public static void main(final String args[]) throws Exception { if( true ) { - chapter01TestLoadLibrary(); + chapter__TestLoadLibrary(); final Test1p2LoadJNIAndImplLib tst = new Test1p2LoadJNIAndImplLib(); - tst.chapter02TestClassExist(); + tst.chapter00TestClassExist(); } else { final String tstname = Test1p2LoadJNIAndImplLib.class.getName(); org.junit.runner.JUnitCore.main(tstname); diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java index 49a1851..917ca96 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java @@ -30,6 +30,7 @@ package com.jogamp.gluegen.test.junit.generation; import java.io.IOException; +import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p1Impl; import com.jogamp.gluegen.test.junit.generation.impl.Bindingtest1p2Impl; import com.jogamp.common.os.NativeLibrary; @@ -54,7 +55,7 @@ public class Test1p2ProcAddressEmitter extends BaseClass { * Verifies loading of the new library. */ @BeforeClass - public static void chapter01TestLoadLibrary() throws Exception { + public static void chapter__TestLoadLibrary() throws Exception { BindingJNILibLoader.loadBindingtest1p2(); dynamicLookupHelper = NativeLibrary.open("test1", Test1p2ProcAddressEmitter.class.getClassLoader(), true); Assert.assertNotNull("NativeLibrary.open(test1) failed", dynamicLookupHelper); @@ -66,7 +67,7 @@ public class Test1p2ProcAddressEmitter extends BaseClass { * Verifies the existence and creation of the generated class. */ @Test - public void chapter02TestClassExist() throws Exception { + public void chapter00TestClassExist() throws Exception { testClassExist("test1p2"); } @@ -79,6 +80,18 @@ public class Test1p2ProcAddressEmitter extends BaseClass { } /** + * Verifies if all generated static constant values are completed, + * and whether their value is as expected! + * <p> + * Covers all enumerates and defines. + * </p> + */ + @Test + public void chapter01TestStaticConstants() throws Exception { + chapter01TestStaticConstants(new Bindingtest1p2Impl()); + } + + /** * Verifies if all methods / signatures are properly generated, * can be invoked and functions. * This is a compilation (coverage) and runtime time (semantic) test. diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h index 4e60114..4896165 100644 --- a/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h +++ b/src/junit/com/jogamp/gluegen/test/junit/generation/test1.h @@ -39,13 +39,53 @@ typedef void * AnonBuffer; // Non Opaque // typedef XID XID_2; // Duplicate w/ compatible type (ignored) - OpenSolaris: Native gcc error // typedef int XID_2; // Duplicate w/ incompatible type ERROR +#define CL_INT_I0 10 +#define CL_INT_I1 11u +#define CL_INT_I2 12U +#define CL_INT_I3 0x0d +#define CL_INT_I4 -14 +#define CL_INT_I5 -15u +#define CL_INT_I6 -16U +#define CL_INT_I7 -0x11U +#define CL_INT_I8 +18 +#define CL_INT_I9 +19u +#define CL_INT_IA +20U +#define CL_INT_IB +0x15u +#define CL_INT_IX 0xffffffffU + +enum CL_INT { ENUM_I0=10, ENUM_I1, ENUM_I2=+12U, ENUM_I3=0x0d, ENUM_I4=-14, ENUM_I5=-15u, ENUM_I6=-16U, ENUM_I7=0x11U, + ENUM_I8=+18, ENUM_I9=+19u, ENUM_IA, ENUM_IB=+0x15u, ENUM_IX=0xffffffffU }; + +#define CL_LNG_L0 2147483648 +#define CL_LNG_L1 0x80000001ul +#define CL_LNG_L2 2147483650UL +#define CL_LNG_L3 0x80000003l +#define CL_LNG_L4 -2147483652L +#define CL_LNG_L5 -2147483653ul +#define CL_LNG_L6 -2147483654lu +#define CL_LNG_L7 -0x80000007UL +#define CL_LNG_L8 +2147483656LU +#define CL_LNG_L9 +2147483657uL +#define CL_LNG_LA +2147483658lU +#define CL_LNG_LB +0x8000000BLu +#define CL_LNG_LX 0xffffffffffffffffUL + #define CL_FLT_A0 0x1p127 #define CL_FLT_A1 0x1p+127F -#define CL_FLT_A2 0x1p-127f +#define CL_FLT_A2 +0x1p-127f +#define CL_FLT_A3 -0.1 +#define CL_FLT_A4 0.2f +#define CL_FLT_A5 0.3F +#define CL_FLT_A6 .4 +#define CL_FLT_A7 1.0 #define CL_DBL_B0 0x1.p127d #define CL_DBL_B1 0x1.p+127D -#define CL_DBL_B2 0x1.p-127d +#define CL_DBL_B2 +0x1.p-127d +#define CL_DBL_B3 -0.1d +#define CL_DBL_B4 0.2D +#define CL_DBL_B5 .3D +#define CL_DBL_B6 3.5e+38 #define CL_FLT_MAX 0x1.fffffep127f #define CL_FLT_MIN 0x1.0p-126f @@ -69,10 +109,22 @@ typedef void * AnonBuffer; // Non Opaque #define NUMBER_ONE CONSTANT_ONE #define NUMBER_TWO ( NUMBER_ONE + NUMBER_ONE ) #define NUMBER_FOUR ( NUMBER_ONE << NUMBER_TWO ) +#define NUMBER_FIVE ( ( CONSTANT_ONE << NUMBER_TWO ) + NUMBER_ONE ) #define NUMBER_EIGHT ( NUMBER_TWO * NUMBER_TWO + ( NUMBER_ONE << NUMBER_TWO ) ) #define NUMBER_NINE ( 2 * 2 + ( 1 << 2 ) + 1 ) #define NUMBER_TEN ( NUMBER_EIGHT | NUMBER_TWO ) +enum NumberOps { ENUM_NUM_ONE = CONSTANT_ONE, + ENUM_NUM_TWO = 1+1, + ENUM_NUM_THREE, + ENUM_NUM_FOUR = ( ENUM_NUM_ONE << ENUM_NUM_TWO ), + ENUM_NUM_FIVE = ( CONSTANT_ONE << ENUM_NUM_TWO ) + ENUM_NUM_ONE, + ENUM_NUM_EIGHT = ( ENUM_NUM_TWO * ENUM_NUM_TWO + ( ENUM_NUM_ONE << ENUM_NUM_TWO ) ), + ENUM_NUM_NINE = ( 2 * 2 + ( 1 << 2 ) + 1 ), + ENUM_NUM_TEN = ENUM_NUM_EIGHT | + ENUM_NUM_TWO + }; + enum Lala { LI=1, LU, LO }; // enum Lala { LI=1, LU, LO }; // Duplicate w/ same value (ignored, ERROR in native compilation) // enum Lala { LI=1, LU=3, LO }; // Duplicate w/ diff value ERROR |