Package jnr.ffi

Examples of jnr.ffi.Address


        void ptr_set_pointer(@Out AddressByReference p, int offset, Address value);
    }
   
    @Test public void inOnlyReferenceSet() {
        TestLibInOnly lib = TstUtil.loadTestLib(TestLibInOnly.class);
        final Address MAGIC = Address.valueOf(0xdeadbeef);
        AddressByReference ref = new AddressByReference(MAGIC);
        assertEquals("Wrong value passed", MAGIC, lib.ptr_ret_pointer(ref, 0));
    }
View Full Code Here


        assertEquals("Wrong value passed", MAGIC, lib.ptr_ret_pointer(ref, 0));
    }

    @Test public void inOnlyIntReferenceNotWritten() {
        TestLibInOnly lib = TstUtil.loadTestLib(TestLibInOnly.class);
        final Address MAGIC = Address.valueOf(0xdeadbeefL);
        AddressByReference ref = new AddressByReference(MAGIC);
        lib.ptr_set_pointer(ref, 0, Address.valueOf(0));
        assertEquals("Int reference written when it should not be", MAGIC, ref.getValue());
    }
View Full Code Here

        assertEquals("Int reference written when it should not be", MAGIC, ref.getValue());
    }

    @Test public void outOnlyIntReferenceNotRead() {
        TestLibOutOnly lib = TstUtil.loadTestLib(TestLibOutOnly.class);
        final Address MAGIC = Address.valueOf(0xdeadbeef);
        AddressByReference ref = new AddressByReference(MAGIC);
        assertTrue("Reference value passed to native code when it should not be", !MAGIC.equals(lib.ptr_ret_pointer(ref, 0)));
    }
View Full Code Here

        assertTrue("Reference value passed to native code when it should not be", !MAGIC.equals(lib.ptr_ret_pointer(ref, 0)));
    }

    @Test public void outOnlyIntReferenceGet() {
        TestLibOutOnly lib = TstUtil.loadTestLib(TestLibOutOnly.class);
        final Address MAGIC = Address.valueOf(0xdeadbeef);
        AddressByReference ref = new AddressByReference(Address.valueOf(0));
        lib.ptr_set_pointer(ref, 0, MAGIC);
        assertEquals("Reference value not set", MAGIC, ref.getValue());
    }
View Full Code Here

TOP

Related Classes of jnr.ffi.Address

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.