| 
            Last change
 on this file since 2e63915 was             5780d0d, checked in by Andrew Beach <ajbeach@…>, 11 months ago           | 
        
        
          | 
             
Removed increment and decrement operators for enumerations from builtins. I am confident the generic fallbacks work because I added tests. 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            360 bytes
           | 
        
      
      
| Line |   | 
|---|
| 1 | // Test increment and decrement operation:
 | 
|---|
| 2 | #include <assert.h>
 | 
|---|
| 3 | 
 | 
|---|
| 4 | enum() Number { One, Two, Three };
 | 
|---|
| 5 | 
 | 
|---|
| 6 | int main(int argc, char * argv[]) {
 | 
|---|
| 7 |         Number a = One;
 | 
|---|
| 8 | 
 | 
|---|
| 9 |         assert( Two == ++a );
 | 
|---|
| 10 |         assert( Two == a );
 | 
|---|
| 11 | 
 | 
|---|
| 12 |         assert( Two == a++ );
 | 
|---|
| 13 |         assert( Three == a );
 | 
|---|
| 14 | 
 | 
|---|
| 15 |         assert( Two == --a );
 | 
|---|
| 16 |         assert( Two == a );
 | 
|---|
| 17 | 
 | 
|---|
| 18 |         assert( Two == a-- );
 | 
|---|
| 19 |         assert( One == a );
 | 
|---|
| 20 | 
 | 
|---|
| 21 |         printf( "done!\n" );
 | 
|---|
| 22 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.