CloneSet72


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
22450.979class_member_declaration
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
12294
src/NHibernate.Test/HQL/HQLFunctions.cs
220119
src/NHibernate.Test/HQL/HQLFunctions.cs
320142
src/NHibernate.Test/HQL/HQLFunctions.cs
420165
src/NHibernate.Test/HQL/HQLFunctions.cs
Clone Instance
1
Line Count
22
Source Line
94
Source File
src/NHibernate.Test/HQL/HQLFunctions.cs

                [Test]
                public void AggregateAvg()
                {
                        using (ISession s = OpenSession())
                        {
                                Animal a1 = new Animal("a1", 20);
                                Animal a2 = new Animal("a2", 10);
                                s.Save(a1);
                                s.Save(a2);
                                s.Flush();
                        }
                        using (ISession s = OpenSession())
                        {
                                // In Select
                                object result = s.CreateQuery("select avg(a.BodyWeight) from Animal a").UniqueResult();
                                Assert.AreEqual( typeof(double), result.GetType());
                                Assert.AreEqual(15D, result);

                                // In where
                                result = s.CreateQuery("select avg(a.BodyWeight) from Animal a having avg(a.BodyWeight)>0").UniqueResult();
                                Assert.AreEqual( typeof(double), result.GetType());
                                Assert.AreEqual(15D, result);
                        }
                }



Clone Instance
2
Line Count
20
Source Line
119
Source File
src/NHibernate.Test/HQL/HQLFunctions.cs

                [Test]
                public void AggregateMax()
                {
                        using (ISession s = OpenSession())
                        {
                                Animal a1 = new Animal("a1", 20);
                                Animal a2 = new Animal("a2", 10);
                                s.Save(a1);
                                s.Save(a2);
                                s.Flush();
                        }
                        using (ISession s = OpenSession())
                        {
                                object result = s.CreateQuery("select max(a.BodyWeight) from Animal a").UniqueResult();
                                Assert.AreEqual( typeof(float), result.GetType()); //use column type
                                Assert.AreEqual(20F, result);

                                result = s.CreateQuery("select max(a.BodyWeight) from Animal a having max(a.BodyWeight)>0").UniqueResult();
                                Assert.AreEqual( typeof(float), result.GetType()); //use column type
                                Assert.AreEqual(20F, result);
                        }
                }



Clone Instance
3
Line Count
20
Source Line
142
Source File
src/NHibernate.Test/HQL/HQLFunctions.cs

                [Test]
                public void AggregateMin()
                {
                        using (ISession s = OpenSession())
                        {
                                Animal a1 = new Animal("a1", 20);
                                Animal a2 = new Animal("a2", 10);
                                s.Save(a1);
                                s.Save(a2);
                                s.Flush();
                        }
                        using (ISession s = OpenSession())
                        {
                                object result = s.CreateQuery("select min(a.BodyWeight) from Animal a").UniqueResult();
                                Assert.AreEqual( typeof(float), result.GetType()); //use column type
                                Assert.AreEqual(10F, result);

                                result = s.CreateQuery("select min(a.BodyWeight) from Animal a having min(a.BodyWeight)>0").UniqueResult();
                                Assert.AreEqual( typeof(float), result.GetType()); //use column type
                                Assert.AreEqual(10F, result);
                        }
                }



Clone Instance
4
Line Count
20
Source Line
165
Source File
src/NHibernate.Test/HQL/HQLFunctions.cs

                [Test]
                public void AggregateSum()
                {
                        using (ISession s = OpenSession())
                        {
                                Animal a1 = new Animal("a1", 20);
                                Animal a2 = new Animal("a2", 10);
                                s.Save(a1);
                                s.Save(a2);
                                s.Flush();
                        }
                        using (ISession s = OpenSession())
                        {
                                object result = s.CreateQuery("select sum(a.BodyWeight) from Animal a").UniqueResult();
                                Assert.AreEqual( typeof(double), result.GetType());
                                Assert.AreEqual(30D, result);

                                result = s.CreateQuery("select sum(a.BodyWeight) from Animal a having sum(a.BodyWeight)>0").UniqueResult();
                                Assert.AreEqual( typeof(double), result.GetType());
                                Assert.AreEqual(30D, result);
                        }
                }



Clone AbstractionParameter Count: 5Parameter Bindings

[Test]
public void [[#variable6e3ffac0]]()
{
   using (ISession s = OpenSession())
   {
      Animal a1 = new Animal("a1", 20);
      Animal a2 = new Animal("a2", 10);
      s.Save(a1);
      s.Save(a2);
      s.Flush();
   }
   using (ISession s = OpenSession())
   {
      // In Select
      object result = s.CreateQuery( [[#variable701fc900]]).UniqueResult();
      Assert.AreEqual( typeof( [[#variable701fc780]]), result.GetType()); //use column type
      Assert.AreEqual( [[#variable701fc6a0]], result);
      // In where
      result = s.CreateQuery( [[#variable701fc5e0]]).UniqueResult();
      Assert.AreEqual( typeof( [[#variable701fc780]]), result.GetType()); //use column type
      Assert.AreEqual( [[#variable701fc6a0]], result);
   }
}

 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#6e3ffac0]]
AggregateAvg 
12[[#6e3ffac0]]
AggregateMax 
13[[#6e3ffac0]]
AggregateMin 
14[[#6e3ffac0]]
AggregateSum 
21[[#701fc900]]
"select avg(a.BodyWeight) from Animal a" 
22[[#701fc900]]
"select max(a.BodyWeight) from Animal a" 
23[[#701fc900]]
"select min(a.BodyWeight) from Animal a" 
24[[#701fc900]]
"select sum(a.BodyWeight) from Animal a" 
31[[#701fc780]]
double 
32[[#701fc780]]
float 
33[[#701fc780]]
float 
34[[#701fc780]]
double 
41[[#701fc6a0]]
15D 
42[[#701fc6a0]]
20F 
43[[#701fc6a0]]
10F 
44[[#701fc6a0]]
30D 
51[[#701fc5e0]]
"select avg(a.BodyWeight) from Animal a having avg(a.BodyWeight)>0" 
52[[#701fc5e0]]
"select max(a.BodyWeight) from Animal a having max(a.BodyWeight)>0" 
53[[#701fc5e0]]
"select min(a.BodyWeight) from Animal a having min(a.BodyWeight)>0" 
54[[#701fc5e0]]
"select sum(a.BodyWeight) from Animal a having sum(a.BodyWeight)>0"