package org.bridj;
import java.io.File;
import org.bridj.ann.Library;
import org.bridj.ann.Virtual;
import org.bridj.cpp.CPPObject;

import org.bridj.*;
import static org.bridj.Pointer.*;
import org.junit.Test;
import static org.junit.Assert.*;

@Library("test") 
public class CPPTest2 {
    
    public static class Module extends CPPObject {
        @Virtual
        public native int add(int a, int b);
    }
    
    public static class IModule extends CPPObject {
        public IModule() {
            super();
        }
        @Virtual(2) 
        public native int add(int a, int b);
        @Virtual(3) 
        public native int subtract(int a, int b);
    }
    
    public static class AModule extends IModule {
        public AModule() {
            super();
        }
        //@Name("AModule") 
        //public native int AModule$2();
        @Virtual(2) 
        public native int add(int a, int b);
        @Virtual(3) 
        public native int subtract(int a, int b);
    }
    
    @Test
    public void test() {
        
        IModule m = new AModule(), i = pointerTo(m).as(IModule.class).get();
        
		assertEquals("AModule.add failed", 3, m.add(1, 2));
		assertEquals("AModule.subtract failed", -1, m.subtract(1, 2));
        
        assertEquals("IModule.add failed", 3, i.add(1, 2));
		assertEquals("IModule.subtract failed", -1, i.subtract(1, 2));
		
        assertEquals("Module.add failed", 3, new Module().add(1, 2));
        
        
    }
}

@@ -237,16 +237,41 @@
 ssert.*;
+%0Aimport org.junit.Ignore;
 %0A%0A@Libra
@@ -1498,10 +1498,594 @@
  %0A    %7D%0A
+    %0A    @Library(%22test%22) %0A    public abstract class IVirtual extends CPPObject %7B%0A        public IVirtual() %7B%0A            super();%0A        %7D%0A        @Virtual(2)%0A        public native int add(int a, int b);%0A    %7D%0A    public static native int testIVirtualAdd(Pointer%3CIVirtual%3E pVirtual, int a, int b);%0A    %0A    @Ignore%0A    @Test%0A %09public void testPureVirtual() %7B%0A %09%09BridJ.register(getClass());%0A %09%09%0A %09%09IVirtual v = new IVirtual() %7B%0A %09%09%09@Override%0A %09%09%09public int add(int a, int b) %7B%0A %09%09%09%09return a * 10 + b * 100;%09%0A %09%09%09%7D%0A %09%09%7D;%0A %09%09assertEquals(210, testIVirtualAdd(pointerTo(v), 1, 2));%0A %09%7D%0A
 %7D%0A

prépare pure virtual C++ classes fix