<commit_before>package unit.issues;

import haxe.Int64;

private class TestKey
{
   public function new() { }
}

class Issue4130 extends Test
{
   #if cpp
	public function test()
	{
        var a = [1];

        var val64 = Int64.make(42,24);
        var valPtr = cpp.Pointer.arrayElem(a,0);

        var int2Int64 = new haxe.ds.IntMap<Int64>();
        int2Int64.set( 42, val64);
        var key:Dynamic = 43;
        int2Int64.set( key, val64);
        eq(int2Int64.get(42),val64);
        eq(int2Int64.get(43),val64);


        var int2Ptr = new haxe.ds.IntMap< cpp.Pointer<Int> >();
        int2Ptr.set( 42, valPtr );
        int2Ptr.set( key, valPtr );
        eq( int2Ptr.get(42), valPtr);
        eq( int2Ptr.get(key), valPtr);


        var string2Int64 = new haxe.ds.StringMap<Int64>();
        string2Int64.set( "42", val64 );
        var key:Dynamic = "43";
        string2Int64.set( "43", val64 );
        eq( string2Int64.get("42"), val64 );
        eq( string2Int64.get(key), val64 );

        var string2Ptr = new haxe.ds.StringMap< cpp.Pointer<Int> >();
        string2Ptr.set( "42", valPtr );
        string2Ptr.set( key, valPtr );
        eq( string2Ptr.get("42"), valPtr );
        eq( string2Ptr.get(key), valPtr );


        var key = new TestKey();
        var obj2Int64 = new haxe.ds.ObjectMap<TestKey,Int64>();
        obj2Int64.set( key, val64);
        eq( obj2Int64.get(key), val64 );

        var obj2Ptr = new haxe.ds.ObjectMap<TestKey, cpp.Pointer<Int> >();
        obj2Ptr.set( key, valPtr );
        eq( obj2Ptr.get(key), valPtr );


        var weak2Int64 = new haxe.ds.WeakMap<TestKey,Int64>();
        weak2Int64.set( key, val64);
        eq( weak2Int64.get(key),val64 );

        var weak2Ptr = new haxe.ds.WeakMap<TestKey, cpp.Pointer<Int> >();
        weak2Ptr.set( key, valPtr );
        eq( weak2Ptr.get(key), valPtr );

	}
   #end
}


<commit_msg>[cpp] Don't do pointer tests on cppia.<commit_after>package unit.issues;

import haxe.Int64;

private class TestKey
{
   public function new() { }
}

class Issue4130 extends Test
{
   #if cpp
	public function test()
	{
        var val64 = Int64.make(42,24);

        var int2Int64 = new haxe.ds.IntMap<Int64>();
        int2Int64.set( 42, val64);
        var key:Dynamic = 43;
        int2Int64.set( key, val64);
        eq(int2Int64.get(42),val64);
        eq(int2Int64.get(43),val64);


        var string2Int64 = new haxe.ds.StringMap<Int64>();
        string2Int64.set( "42", val64 );
        var key:Dynamic = "43";
        string2Int64.set( "43", val64 );
        eq( string2Int64.get("42"), val64 );
        eq( string2Int64.get(key), val64 );


        var key = new TestKey();
        var obj2Int64 = new haxe.ds.ObjectMap<TestKey,Int64>();
        obj2Int64.set( key, val64);
        eq( obj2Int64.get(key), val64 );

        var weak2Int64 = new haxe.ds.WeakMap<TestKey,Int64>();
        weak2Int64.set( key, val64);
        eq( weak2Int64.get(key),val64 );

        #if !cppia
        var a = [1];
        var valPtr = cpp.Pointer.arrayElem(a,0);

        var int2Ptr = new haxe.ds.IntMap< cpp.Pointer<Int> >();
        int2Ptr.set( 42, valPtr );
        int2Ptr.set( key, valPtr );
        eq( int2Ptr.get(42), valPtr);
        eq( int2Ptr.get(key), valPtr);

        var string2Ptr = new haxe.ds.StringMap< cpp.Pointer<Int> >();
        string2Ptr.set( "42", valPtr );
        string2Ptr.set( key, valPtr );
        eq( string2Ptr.get("42"), valPtr );
        eq( string2Ptr.get(key), valPtr );

        var obj2Ptr = new haxe.ds.ObjectMap<TestKey, cpp.Pointer<Int> >();
        obj2Ptr.set( key, valPtr );
        eq( obj2Ptr.get(key), valPtr );

        var weak2Ptr = new haxe.ds.WeakMap<TestKey, cpp.Pointer<Int> >();
        weak2Ptr.set( key, valPtr );
        eq( weak2Ptr.get(key), valPtr );
        #end
	}
   #end
}



{'fraction_non_alphanumeric': 0.15013054830287206, 'fraction_numerical': 0.07101827676240209, 'mean_word_length': 2.3025862068965517, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5817681', 'n_tokens_mistral': 1557, 'n_tokens_neox': 1396, 'n_words': 293}