Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldEncodeStringWithZeroLength()
        public virtual void ShouldEncodeStringWithZeroLength()
        {
            // GIVEN
            Encoder encoder = new StringEncoder();

            // WHEN
            long eId = encoder.Encode("");

            // THEN
            assertTrue(eId != 0);
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldEncodeStringWithAnyLength()
        public virtual void ShouldEncodeStringWithAnyLength()
        {
            // GIVEN
            Encoder encoder = new StringEncoder();

            // WHEN
            MutableLongSet encoded    = new LongHashSet();
            int            total      = 1_000;
            int            duplicates = 0;

            for (int i = 0; i < total; i++)
            {
                // THEN
                long encode = encoder.Encode(AbcStringOfLength(i));
                assertTrue(encode != 0);
                if (!encoded.add(encode))
                {
                    duplicates++;
                }
            }
            assertTrue((( float )duplicates / ( float )total) < 0.01f);
        }