public void ComparisonOperator_WithIntTest(LockTime lt, int i, ValueCompareResult expected) { Assert.Equal(expected.Bigger, lt > i); Assert.Equal(expected.Bigger, lt > (long)i); Assert.Equal(expected.Bigger, i < lt); Assert.Equal(expected.Bigger, (long)i < lt); Assert.Equal(expected.BiggerEqual, lt >= i); Assert.Equal(expected.BiggerEqual, lt >= (long)i); Assert.Equal(expected.BiggerEqual, i <= lt); Assert.Equal(expected.BiggerEqual, (long)i <= lt); Assert.Equal(expected.Smaller, lt < i); Assert.Equal(expected.Smaller, lt < (long)i); Assert.Equal(expected.Smaller, i > lt); Assert.Equal(expected.Smaller, (long)i > lt); Assert.Equal(expected.SmallerEqual, lt <= i); Assert.Equal(expected.SmallerEqual, lt <= (long)i); Assert.Equal(expected.SmallerEqual, i >= lt); Assert.Equal(expected.SmallerEqual, (long)i >= lt); Assert.Equal(expected.Equal, lt == i); Assert.Equal(expected.Equal, i == lt); Assert.Equal(expected.Equal, lt == (long)i); Assert.Equal(expected.Equal, (long)i == lt); Assert.Equal(!expected.Equal, lt != i); Assert.Equal(!expected.Equal, i != lt); Assert.Equal(!expected.Equal, lt != (long)i); Assert.Equal(!expected.Equal, (long)i != lt); }
public void ComparisonOperator_WithIntTest(CompactInt ci, int i, ValueCompareResult expected) { Assert.Equal(expected.Bigger, ci > i); Assert.Equal(expected.Bigger, ci > (long)i); Assert.Equal(expected.Bigger, i < ci); Assert.Equal(expected.Bigger, (long)i < ci); Assert.Equal(expected.BiggerEqual, ci >= i); Assert.Equal(expected.BiggerEqual, ci >= (long)i); Assert.Equal(expected.BiggerEqual, i <= ci); Assert.Equal(expected.BiggerEqual, (long)i <= ci); Assert.Equal(expected.Smaller, ci < i); Assert.Equal(expected.Smaller, ci < (long)i); Assert.Equal(expected.Smaller, i > ci); Assert.Equal(expected.Smaller, (long)i > ci); Assert.Equal(expected.SmallerEqual, ci <= i); Assert.Equal(expected.SmallerEqual, ci <= (long)i); Assert.Equal(expected.SmallerEqual, i >= ci); Assert.Equal(expected.SmallerEqual, (long)i >= ci); Assert.Equal(expected.Equal, ci == i); Assert.Equal(expected.Equal, i == ci); Assert.Equal(expected.Equal, ci == (long)i); Assert.Equal(expected.Equal, (long)i == ci); Assert.Equal(!expected.Equal, ci != i); Assert.Equal(!expected.Equal, i != ci); Assert.Equal(!expected.Equal, ci != (long)i); Assert.Equal(!expected.Equal, (long)i != ci); }
public void ComparisonOperator_SameTypeTest(Target si1, Target si2, ValueCompareResult expected) { Assert.Equal(expected.Bigger, si1 > si2); Assert.Equal(expected.BiggerEqual, si1 >= si2); Assert.Equal(expected.Smaller, si1 < si2); Assert.Equal(expected.SmallerEqual, si1 <= si2); Assert.Equal(expected.Equal, si1 == si2); Assert.Equal(!expected.Equal, si1 != si2); Assert.Equal(expected.Equal, si1.Equals(si2)); Assert.Equal(expected.Equal, si1.Equals((object)si2)); Assert.Equal(expected.Compare, si1.CompareTo(si2)); Assert.Equal(expected.Compare, si1.CompareTo((object)si2)); }
public void ComparisonOperator_SameTypeTest(LockTime lt1, LockTime lt, ValueCompareResult expected) { Assert.Equal(expected.Bigger, lt1 > lt); Assert.Equal(expected.BiggerEqual, lt1 >= lt); Assert.Equal(expected.Smaller, lt1 < lt); Assert.Equal(expected.SmallerEqual, lt1 <= lt); Assert.Equal(expected.Equal, lt1 == lt); Assert.Equal(!expected.Equal, lt1 != lt); Assert.Equal(expected.Equal, lt1.Equals(lt)); Assert.Equal(expected.Equal, lt1.Equals((object)lt)); Assert.Equal(expected.Compare, lt1.CompareTo(lt)); Assert.Equal(expected.Compare, lt1.CompareTo((object)lt)); }
public void ComparisonOperator_SameTypeTest(CompactInt ci1, CompactInt ci2, ValueCompareResult expected) { Assert.Equal(expected.Bigger, ci1 > ci2); Assert.Equal(expected.BiggerEqual, ci1 >= ci2); Assert.Equal(expected.Smaller, ci1 < ci2); Assert.Equal(expected.SmallerEqual, ci1 <= ci2); Assert.Equal(expected.Equal, ci1 == ci2); Assert.Equal(!expected.Equal, ci1 != ci2); Assert.Equal(expected.Equal, ci1.Equals(ci2)); Assert.Equal(expected.Equal, ci1.Equals((object)ci2)); Assert.Equal(expected.Compare, ci1.CompareTo(ci2)); Assert.Equal(expected.Compare, ci1.CompareTo((object)ci2)); }
public void ComparisonOperator_WithIntTest(Target si, int i, ValueCompareResult expected) { Assert.Equal(expected.Bigger, si > i); Assert.Equal(expected.Bigger, i < si); Assert.Equal(expected.BiggerEqual, si >= i); Assert.Equal(expected.BiggerEqual, i <= si); Assert.Equal(expected.Smaller, si < i); Assert.Equal(expected.Smaller, i > si); Assert.Equal(expected.SmallerEqual, si <= i); Assert.Equal(expected.SmallerEqual, i >= si); Assert.Equal(expected.Equal, si == i); Assert.Equal(expected.Equal, i == si); Assert.Equal(!expected.Equal, si != i); Assert.Equal(!expected.Equal, i != si); }
/// <summary> /// ��ȡ�¶ȶ�Ӧ����Ϣ /// </summary> /// <param name="monitorData"></param> /// <param name="curIndex"></param> /// <param name="backClr"></param> /// <param name="displayStr"></param> public static void CaculateTempStatisticsInfo(ScannerMonitorData monitorData, float threshold, out ValueCompareResult valueCompareRes, out MonitorInfoResult resType, ref TempAndHumiStatisticsInfo statisticsInfo) { valueCompareRes = ValueCompareResult.Unknown; resType = MonitorInfoResult.Unknown; if (monitorData != null) { if (monitorData.TemperatureOfScanCard.IsValid) { float fValue = monitorData.TemperatureOfScanCard.Value; int nValue = (int)fValue; if (nValue > threshold) { resType = MonitorInfoResult.Alarm; } else { resType = MonitorInfoResult.Ok; } if (statisticsInfo.ValidScanBoardCnt <= 0) { //��ǰɨ�迨����Ϊ0ʱ����ȡ��ǰ�¶� statisticsInfo.MinValue = nValue; statisticsInfo.MaxValue = nValue; valueCompareRes = ValueCompareResult.IsFirstValidValue; } else { //��ȡ��ǰ��С�¶Ⱥ�����¶� if (statisticsInfo.MinValue > nValue) { valueCompareRes = ValueCompareResult.BelowMinValue; statisticsInfo.MinValue = nValue; } else if (statisticsInfo.MinValue == nValue) { valueCompareRes = ValueCompareResult.EqualsMinValue; } if (statisticsInfo.MaxValue < nValue) { valueCompareRes = ValueCompareResult.AboveMaxValue; statisticsInfo.MaxValue = nValue; } else if (statisticsInfo.MaxValue == nValue) { if (valueCompareRes == ValueCompareResult.EqualsMinValue) { valueCompareRes = ValueCompareResult.EqualsBothValue; } else { valueCompareRes = ValueCompareResult.EqualsMaxValue; } } } statisticsInfo.ValidScanBoardCnt++; statisticsInfo.TotalValue += nValue; statisticsInfo.AllValueList.Add(nValue); } } }