예제 #1
0
 public void TestEquals()
 {
     Assert.IsTrue(MyInt64_1.Equals(MyInt64_1));
     Assert.IsTrue(MyInt64_1.Equals((object)(Int64)(-42)));
     Assert.IsTrue(MyInt64_1.Equals((object)(SByte)(-42)) == false);
     Assert.IsTrue(MyInt64_1.Equals(MyInt64_2) == false);
 }
예제 #2
0
    public static void TestEquals()
    {
        Int64 i = -911;

        Assert.True(i.Equals((Int64)(-911)));

        Assert.True(!i.Equals((Int64)911));
        Assert.True(!i.Equals((Int64)0));
    }
예제 #3
0
        public void EqualityHasValueSemantics()
        {
            var num1 = new Int64(long.MaxValue);
            var num2 = new Int64(long.MinValue);
            var num3 = new Int64(long.MaxValue);

            Assert.IsTrue(num1.Equals(num1));
            Assert.IsTrue(num1 == num1);

            Assert.IsTrue(num1.Equals(num3));
            Assert.IsTrue(num1 == num3);

            Assert.IsFalse(num1.Equals(num2));
            Assert.IsTrue(num1 != num2);
        }
예제 #4
0
        /// <summary>
        /// Carrega o combo de escola a partir do código do docente e entidade. Usado na visão individual
        /// Utilizado nas telas: Documentos do docente, Atribuição do docente, Compensação de Ausências.
        /// </summary>
        /// <param name="doc_id">Código do docente</param>
        /// <param name="ent_id">Código da entidade</param>
        /// <param name="vinculoColaboradorCargo">True - Busca as escolas do docente pelo vinculo de colaborador cargo
        ///                                       False - Busca as escolas pelas atribuições de turma docente do docente</param>
        public void InicializarVisaoIndividual(Int64 doc_id, Guid ent_id, Byte vinculoColaboradorCargo)
        {
            try
            {
                lblUA.Visible = false;
                ddlUA.Visible = false;

                FiltroEscola = false;

                cpvUA.Visible = false;

                if (!doc_id.Equals(0) && !ent_id.Equals(Guid.Empty))
                {
                    CarregaUnidadesEscolasVisaoIndividual(doc_id, ent_id, vinculoColaboradorCargo);
                }

                if ((ObrigatorioEscola) && (!lblEscola.Text.Contains("*")))
                {
                    lblEscola.Text += " *";
                }

                if (!ObrigatorioEscola)
                {
                    lblEscola.Text = lblEscola.Text.Replace(ApplicationWEB.TextoAsteriscoObrigatorio, "");
                    lblEscola.Text = lblEscola.Text.Replace(" *", "");
                }

                cpvEscola.Visible = ObrigatorioEscola;
            }
            catch (Exception ex)
            {
                ApplicationWEB._GravaErro(ex);
            }
        }
예제 #5
0
    public static void Main()
    {
        try
        {
// <Snippet1>
            Int64 myVariable1 = 80;
            Int64 myVariable2 = 80;

            // Get and display the declaring type.
            Console.WriteLine("\nType of 'myVariable1' is '{0}' and" +
                              " value is :{1}", myVariable1.GetType(), myVariable1);
            Console.WriteLine("Type of 'myVariable2' is '{0}' and" +
                              " value is :{1}", myVariable2.GetType(), myVariable2);

            // Compare 'myVariable1' instance with 'myVariable2' Object.
            if (myVariable1.Equals(myVariable2))
            {
                Console.WriteLine("\nStructures 'myVariable1' and " +
                                  "'myVariable2' are equal");
            }
            else
            {
                Console.WriteLine("\nStructures 'myVariable1' and " +
                                  "'myVariable2' are not equal");
            }

// </Snippet1>
        }
        catch (Exception e)
        {
            Console.WriteLine("Exception :{0}", e.Message);
        }
    }
예제 #6
0
 protected object CheckParamValue(Int64 paramValue) {
    if (paramValue.Equals(Constants.NullInt)) {
       return DBNull.Value;
    } else {
       return paramValue;
    }
 }
예제 #7
0
        private static bool VerifyInt64ImplicitCastToBigInteger(Int64 value)
        {
            bool       ret = true;
            BigInteger bigInteger;

            bigInteger = value;

            ret &= Eval(bigInteger.Equals(value), String.Format("Expected BigInteger {0} to be equal to Int64 {1}", bigInteger, value));
            ret &= Eval(value.ToString(), bigInteger.ToString(), "Int64.ToString() and BigInteger.ToString()");
            ret &= Eval(value, (Int64)bigInteger, "Round tripped Int64");

            if (value != Int64.MaxValue)
            {
                ret &= Eval((Int64)(value + 1), (Int64)(bigInteger + 1), "BigInteger added to 1");
            }

            if (value != Int64.MinValue)
            {
                ret &= Eval((Int64)(value - 1), (Int64)(bigInteger - 1), "BigInteger subtracted by 1");
            }

            ret &= VerifyBigintegerUsingIdentities(bigInteger, 0 == value);

            return(ret);
        }
예제 #8
0
    public static void TestEqualsObject()
    {
        Int64 i = 789;

        object obj1 = (Int64)789;

        Assert.True(i.Equals(obj1));

        object obj2 = (Int64)(-789);

        Assert.True(!i.Equals(obj2));

        object obj3 = (Int64)0;

        Assert.True(!i.Equals(obj3));
    }
예제 #9
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }


            var other = (VLMessageRecipient)obj;

            //reference types
            if (!Object.Equals(Error, other.Error))
            {
                return(false);
            }
            //value types
            if (!m_message.Equals(other.m_message))
            {
                return(false);
            }
            if (!m_recipient.Equals(other.m_recipient))
            {
                return(false);
            }
            if (!m_attributeFlags.Equals(other.m_attributeFlags))
            {
                return(false);
            }
            if (!m_errorCount.Equals(other.m_errorCount))
            {
                return(false);
            }
            if (!m_sendDT.Equals(other.m_sendDT))
            {
                return(false);
            }
            if (!m_status.Equals(other.m_status))
            {
                return(false);
            }
            if (!m_collectorPayment.Equals(other.m_collectorPayment))
            {
                return(false);
            }
            if (!m_isCharged.Equals(other.m_isCharged))
            {
                return(false);
            }

            return(true);
        }
예제 #10
0
 public override bool  Equals(object obj)
 {
     if (obj == null || !(obj is CounterDataStoreKey))
     {
         return(false);
     }
     return(Counter.Equals(((CounterDataStoreKey)obj).Counter));
 }
        public void TryParseCoreString_InvalidInput_ReturnsFalse()
        {
            var _inputString = "adsfkjgasdfkgdfkasgj";
            var _match       = 0xF;

            var _isCoreString = BitmaskExtensions.TryParseCoreString(_inputString, out long _result);
            var result        = _isCoreString && Int64.Equals((long)_match, (long)_result);

            Assert.IsFalse(result);
        }
        public void TryParseAffinity_16CoreBitmask_ReturnsTrue()
        {
            var  _inputString = "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31";
            long _match       = 0xAAAAAAAA; // core1-core31 alternating

            var _isCoreString = BitmaskExtensions.TryParseAffinity(_inputString, out long _result);
            var result        = _isCoreString && Int64.Equals(_match, _result);

            Assert.IsTrue(result);
        }
예제 #13
0
        public override bool Equals(object operand)
        {
            if (!(operand is ObjectId))
            {
                return(false);
            }
            var other = (ObjectId)operand;

            return(_id.Equals(other._id));
        }
        public void TryParseCoreString_QuadCoreString_ReturnsTrue()
        {
            var _inputString = "0,1,2,3";
            var _match       = 0xF; // core0-core3

            var _isCoreString = BitmaskExtensions.TryParseCoreString(_inputString, out long _result);
            var result        = Int64.Equals((long)_match, (long)_result);

            Assert.IsTrue(result);
        }
예제 #15
0
 protected bool IsDifferent(Int64 a, Int64 b, PropertyPath path)
 {
     if (!Int64.Equals(a, b))
     {
         Report(path, $"different values '{a}' != '{b}'"); return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #16
0
    static void Main()
    {
        Int64 i64 = 0L;

        Console.WriteLine(i64.Equals(0));     // True

        object boxed = i64;

        Console.WriteLine(boxed.Equals(0));     // False
        Console.WriteLine(boxed.Equals(0L));    // True
    }
예제 #17
0
 protected object CheckParamValue(Int64 paramValue)
 {
     if (paramValue.Equals(CallingList.Common.ClsConstants.NullInt64))
     {
         return DBNull.Value;
     }
     else
     {
         return paramValue;
     }
 }
예제 #18
0
        /// <summary>
        /// Determines whether the specified <see cref="System.Object" /> is equal to this <see cref="SecsInt64"/> instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this <see cref="SecsInt64"/> instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this <see cref="SecsInt64"/> instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object obj)
        {
            if (obj == null || !(obj is SecsInt64))
            {
                return(false);
            }

            SecsInt64 sobj = obj as SecsInt64;

            return(_value.Equals(sobj._value));
        }
        public void TryParseAffinity_OverflowSanity_ReturnsTrue()
        {
            // overflow test
            var  _inputString = "1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47";
            long _match       = 0xAAAAAAAA; // core0-core31 alternating

            var _isCoreString = BitmaskExtensions.TryParseAffinity(_inputString, out long _result);
            // should truncate to 32 bits [0-31]
            var result = _isCoreString && Int64.Equals(_match, _result);

            Assert.IsTrue(result);
        }
예제 #20
0
        public bool ValidaCampos()
        {
            try
            {
                //limpa a lista
                FornecedorRegiaoObj.Clear();

                int    count       = 0;
                Int64  fornecedor  = ddlFornecedor.SelectedItem.Equals("Selecione") ? Int64.MinValue : Convert.ToInt64(ddlFornecedor.SelectedValue);
                bool[] arrayChecks = new bool[gridFornecedor.Rows.Count];

                if (fornecedor.Equals(int.MinValue))
                {
                    return(false);
                }


                //verifica se preencheu algum checkbox
                foreach (GridViewRow item in gridFornecedor.Rows)
                {
                    Literal Regiao   = (Literal)item.FindControl("LitIdRegiao");
                    Int64   IdRegiao = Convert.ToInt64(Regiao.Text);

                    //insere a propriedade check no array
                    CheckBox Check = (CheckBox)item.FindControl("checkGrid");
                    arrayChecks[count] = Check.Checked;

                    //adiciona somente que está checado
                    if (Check.Checked)
                    {
                        //adiciona na datatable
                        FornecedorRegiaoObj.Rows.Add(IdRegiao, fornecedor);
                    }

                    //adiciona mais um
                    count += 1;
                }

                //verifica se ao menos uma está preechida
                if (arrayChecks.Contains(true))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #21
0
        public static void TestInvokeMethod5()
        {
            MethodInfo   mi          = null;
            Co1333Invoke clsObj      = new Co1333Invoke();
            Int64        retVal      = 0;
            Int64        expectedVal = Int64.MaxValue;

            mi     = getMethod(typeof(Co1333Invoke), "ReturnLongMax");
            retVal = (Int64)mi.Invoke(clsObj, (Object[])null);

            Assert.True(retVal.Equals(expectedVal), String.Format("Failed! MethodInfo.Invoke did not return correct result. Expected {0} , Got {1}", expectedVal, retVal));
        }
예제 #22
0
        private void MethodTests()
        {
            featureTest.FailureMessage = "\tFailed Int64 Method Test";
            featureTest.Send("Int64 Method Test");
            Int64  value1 = 1;
            Int64  value2 = 2;
            Int64  value3 = 3;
            Object obj1   = value1;
            Object obj2   = value2;
            Object obj3   = value3;

            featureTest.AssertTrue(value2.CompareTo(value1) > 0);
            featureTest.AssertTrue(value2.CompareTo(value3) < 0);
            featureTest.AssertTrue(value2.CompareTo(value2) == 0);

            featureTest.AssertTrue(value2.CompareTo(obj1) > 0);
            featureTest.AssertTrue(value2.CompareTo(obj3) < 0);
            featureTest.AssertTrue(value2.CompareTo(obj2) == 0);

            featureTest.AssertTrue(!value2.Equals(value1));
            featureTest.AssertTrue(!value2.Equals(value3));
            featureTest.AssertTrue(value2.Equals(value2));

            featureTest.AssertTrue(!value2.Equals(obj1));
            featureTest.AssertTrue(!value2.Equals(obj3));
            featureTest.AssertTrue(value2.Equals(obj2));
            featureTest.AssertTrue(Int64.Parse("33") == 33);
            String str = 35.ToString();

            featureTest.AssertTrue(str == "35");
            Int64 parsed;

            featureTest.AssertTrue(Int64.TryParse(str, out parsed));
            featureTest.AssertTrue(parsed == 35);
        }
예제 #23
0
        public void HexToInt()
        {
            BitmapWrapper bm1 = new BitmapWrapper(@"d:\temp\analysis\640x480\test_0.jpg");

            for (int i = 0; i < bm1.bitmap.Width; i++)
            {
                for (int n = 0; n < bm1.bitmap.Height; n++)
                {
                    Int64 num1 = Int64.Parse(bm1.bitmap.GetPixel(i, n).Name, System.Globalization.NumberStyles.HexNumber);
                    Int64 num2 = (bm1.bitmap.GetPixel(i, n).Name.HexToLong());
                    Assert.IsTrue(num1.Equals(num2));
                }
            }
        }
예제 #24
0
        /// <summary>
        /// To the int64.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static long ToInt64(this string value)
        {
            Int64 result = 0;

            if (!string.IsNullOrEmpty(value))
            {
                Int64.TryParse(value, out result);
            }
            if (result.Equals(0) && !string.IsNullOrEmpty(value) && value.Contains('.'))
            {
                result = Convert.ToInt64(value.ToDouble());
            }
            return(result);
        }
예제 #25
0
파일: Utils.cs 프로젝트: terje/ontap-api
 public static void SetupDB()
 {
     using (var con = GetSqliteConnection())
     {
         Int64 result = (Int64)con.ExecuteScalar("SELECT count() FROM sqlite_master where tbl_name = 'migrations'");
         if (result.Equals(0))
         {
             con.Execute("CREATE TABLE IF NOT EXISTS 'migrations' (executiondate, name)");
             con.Execute(@"INSERT INTO migrations (executiondate, name) 
                                 VALUES (CAST((julianday('now') - 2440587.5)*86400000 AS INTEGER), @Name)",
                         new { Name = "MigrationsTable" });
         }
         con.Close();
     }
 }
예제 #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        type          = Convert.ToInt32(Request.QueryString["type"]);
        typeVal.Value = type.ToString();

        if (!chargeNo.Equals(null))
        {
            chargeNo = Convert.ToInt64(Request.QueryString["chargeNo"]);
        }

        userNo          = Convert.ToInt32(Request.QueryString["userNo"]);
        userNoVal.Value = userNo.ToString();
        userId          = userInfoGet(userNo);
        balance         = Convert.ToInt32(Request.QueryString["balance"]);
    }
예제 #27
0
        private Int64 Opcode8(ref Dictionary <string, string> array, Int64 position1, Int64 position2, Int64 position3, string parameter1, string parameter2, string parameter3)
        {
            Int64 nextPosition = 0;

            try
            {
                Int64 number1 = position1;
                Int64 number2 = position2;
                Int64 number3 = position3;

                if (parameter1.Equals("0"))
                {
                    number1 = GetValueInposition(array, position1);
                }
                else if (parameter1.Equals("2"))
                {
                    number1 = GetValueInposition(array, position1 + relativeBase);
                }

                if (parameter2.Equals("0"))
                {
                    number2 = GetValueInposition(array, position2);
                }
                else if (parameter2.Equals("2"))
                {
                    number2 = GetValueInposition(array, position2 + relativeBase);
                }

                if (parameter3.Equals("2"))
                {
                    number3 = position3 + relativeBase;
                }

                if (number1.Equals(number2))
                {
                    array[number3.ToString()] = "1";
                }
                else
                {
                    array[number3.ToString()] = "0";
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("There was an error in Opcode8(): {0}", ex.Message);
            }
            return(nextPosition);
        }
예제 #28
0
파일: Day201606.cs 프로젝트: payou42/aoc
        public string Run(Aoc.Framework.Part part)
        {
            string decoded = "";

            for (int j = 0; j < _messages[0].Length; ++j)
            {
                Registers <Int64> counter = new Registers <Int64>();
                foreach (string s in _messages)
                {
                    counter[s[j].ToString()]++;
                }
                Int64 check = (part == Aoc.Framework.Part.Part1) ? counter.Storage.Values.Max() : counter.Storage.Values.Min();
                decoded += counter.Storage.Where(pair => check.Equals(pair.Value)).Select(pair => pair.Key).First();
            }
            return(decoded);
        }
예제 #29
0
        private Operand executeLHSInteger()
        {
            switch (this.RightHandSide.Type)
            {
            case OperandType.Decimal:
                return(new BooleanOperand(Int64.Equals(this.LeftHandSide.AsInteger, (long)this.RightHandSide.AsDecimal)));

            case OperandType.Integer:
                return(new BooleanOperand(Int64.Equals(this.LeftHandSide.AsInteger, (decimal)this.RightHandSide.AsInteger)));

            case OperandType.DateTime:
            case OperandType.Boolean:
            case OperandType.String:
            default:
                throw new EqualException(this.LeftHandSide.Type, this.RightHandSide.Type);
            }
        }
예제 #30
0
        public ActionResult NuevoIngreso(Int64 folio)
        {
            var     datosEncabezadoIngreso = new Ingreso();
            var     datosDetalleIngreso    = new DetalleIngreso();
            Ingreso objIngreso             = new Ingreso();

            //DetalleIngreso objDetalleIngreso = new DetalleIngreso();

            if (folio.Equals(0))
            {
                objIngresoNeg.GenerarFolioIngreso(objIngreso);
                datosEncabezadoIngreso = objIngreso;
            }
            else
            {
                Ingreso objEncabezadoIngreso = new Ingreso(folio);
                objIngresoNeg.TraeEncabezadoIngreso(objEncabezadoIngreso);
                datosEncabezadoIngreso = objEncabezadoIngreso;
            }

            DetalleIngreso        objDetalleIngreso   = new DetalleIngreso(folio);
            List <DetalleIngreso> ListaDetalleIngreso = objDetalleIngresoNeg.TraeDetalleIngreso(objDetalleIngreso);

            //SelectList ListaHistoricoGestion = new SelectList(dataHistoricoGestion, "idResultadoGestion", "nombreResultadoGestion");
            ViewBag.ListaDetalleIngresos = ListaDetalleIngreso;

            List <Unidad> dataUnidad  = objUnidadNeg.GetUnidad();
            SelectList    ListaUnidad = new SelectList(dataUnidad, "idUnidad", "nombreUnidad");

            ViewBag.ListaUnidades = ListaUnidad;

            List <Evento> dataEvento  = objEventoNeg.GetEvento();
            SelectList    ListaEvento = new SelectList(dataEvento, "idEvento", "nombreEvento");

            ViewBag.ListaEventos = ListaEvento;

            List <FormaPago> dataFormaPago  = objFormaPagoNeg.GetFormaPago();
            SelectList       ListaFormaPago = new SelectList(dataFormaPago, "idFormaPago", "nombreFormaPago");

            ViewBag.ListaFormaPagos = ListaFormaPago;


            return(View(Tuple.Create(datosEncabezadoIngreso)));//(Tuple.Create(datosHabilitado, datosGestion, datosTipoGestion, datosHistoricoGestion));
        }