1 import cpp11_constexpr.*; 2 3 public class cpp11_constexpr_runme { 4 5 static { 6 try { 7 System.loadLibrary("cpp11_constexpr"); 8 } catch (UnsatisfiedLinkError e) { 9 System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); 10 System.exit(1); 11 } 12 } 13 check(int received, int expected)14 private static void check(int received, int expected) { 15 if (expected != received) 16 throw new RuntimeException("check failed, expected: " + expected + " received: " + received); 17 } 18 main(String argv[])19 public static void main(String argv[]) 20 { 21 check(cpp11_constexpr.getAAA(), 10); 22 check(cpp11_constexpr.getBBB(), 20); 23 check(cpp11_constexpr.CCC(), 30); 24 check(cpp11_constexpr.DDD(), 40); 25 26 ConstExpressions ce = new ConstExpressions(0); 27 check(ce.JJJ, 100); 28 check(ce.KKK, 200); 29 check(ce.LLL, 300); 30 check(ce.MMM(), 400); 31 check(ce.NNN(), 500); 32 } 33 } 34