Esempio n. 1
0
    public void BoolValue()
    {
      var sut = new SimpleValuesHolder();

      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      
      sut.b = true;
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
    }
Esempio n. 2
0
    //[Test]
    //public void AreWeGeneratingAsStandardGetHashcodeWithStd()
    //{
    //  compiler.should_inline_hash_for_primitives = false; // use .GetHashCode() on all input
    //  var sut = new SimpleValuesHolder(compiler);
    //  StandardTesting(sut);
    //}

    void StandardTesting(SimpleValuesHolder sut)
    {
      // TODO test alle felterne

      sut.c = 'c';
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      Assert.AreEqual(10, debugStats.statsPrimitive, "fields compiled");


      sut.i = 42433;
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.ui = 2983983;
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.b = true;
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.l = -23832232;
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.ul = 399992;
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.by = 3;
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));
      Console.WriteLine(sut.GetHash(compiler));
    }
Esempio n. 3
0
 public void NoValues()
 {
   var sut = new SimpleValuesHolder();
   int expected = sut.ExpectedFromCodegen();
   
   Assert.AreEqual(expected, sut.GetHash(compiler));
   Assert.AreEqual(10, debugStats.statsPrimitive, "fields compiled");
   Assert.AreEqual(0, debugStats.StatsEnum);
   Assert.AreEqual(0, debugStats.StatsIcollection);
 }
Esempio n. 4
0
    public void Value()
    {
      var sut = new SimpleValuesHolder();

      sut.c = 'c';
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      Assert.AreEqual(10, debugStats.statsPrimitive, "fields compiled");


      sut.i = 42433;
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.ui = 2983983;
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.b = true;
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.l = -23832232;
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.ul = 399992;
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

      sut.by = 3;
      Assert.AreEqual(sut.ExpectedFromCodegen(), sut.GetHash(compiler));
      Assert.AreEqual(sut.StandardHashCode(), sut.GetHash(compiler));

    }