Skip to content

Commit bad1e53

Browse files
tmilnthorpangularsen
authored andcommitted
Add heat flux units with tests (#431)
* Adding heat flux units with tests * Adding all permutations for operator overloads with heat flux
1 parent b1b057b commit bad1e53

File tree

10 files changed

+2598
-1
lines changed

10 files changed

+2598
-1
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated (once) by \generate-code.bat, but will not be
4+
// regenerated when it already exists. The purpose of creating this file is to make
5+
// it easier to remember to implement all the unit conversion test cases.
6+
//
7+
// Whenever a new unit is added to this quantity and \generate-code.bat is run,
8+
// the base test class will get a new abstract property and cause a compile error
9+
// in this derived class, reminding the developer to implement the test case
10+
// for the new unit.
11+
//
12+
// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
13+
//
14+
// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
15+
// Add Extensions\MyQuantityExtensions.cs to decorate quantities with new behavior.
16+
// Add UnitDefinitions\MyQuantity.json and run GeneratUnits.bat to generate new units or quantities.
17+
//
18+
// </auto-generated>
19+
//------------------------------------------------------------------------------
20+
21+
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
22+
// https://github.com/angularsen/UnitsNet
23+
//
24+
// Permission is hereby granted, free of charge, to any person obtaining a copy
25+
// of this software and associated documentation files (the "Software"), to deal
26+
// in the Software without restriction, including without limitation the rights
27+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
28+
// copies of the Software, and to permit persons to whom the Software is
29+
// furnished to do so, subject to the following conditions:
30+
//
31+
// The above copyright notice and this permission notice shall be included in
32+
// all copies or substantial portions of the Software.
33+
//
34+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
40+
// THE SOFTWARE.
41+
42+
43+
using System;
44+
using Xunit;
45+
46+
namespace UnitsNet.Tests.CustomCode
47+
{
48+
public class HeatFluxTests : HeatFluxTestsBase
49+
{
50+
protected override double BtusPerHourSquareFootInOneWattPerSquareMeter => 3.16998331e-1;
51+
protected override double BtusPerMinuteSquareFootInOneWattPerSquareMeter => 5.28330551e-3;
52+
protected override double BtusPerSecondSquareFootInOneWattPerSquareMeter => 8.80550918e-5;
53+
protected override double BtusPerSecondSquareInchInOneWattPerSquareMeter => 6.11493693e-7;
54+
protected override double CaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter => 2.388458966e-5;
55+
protected override double CentiwattsPerSquareMeterInOneWattPerSquareMeter => 1e2;
56+
protected override double DeciwattsPerSquareMeterInOneWattPerSquareMeter => 1e1;
57+
protected override double KilocaloriesPerSecondSquareCentimeterInOneWattPerSquareMeter => 2.388458966e-8;
58+
protected override double KilocaloriesPerHourSquareMeterInOneWattPerSquareMeter => 8.59845227859e-1;
59+
protected override double KilowattsPerSquareMeterInOneWattPerSquareMeter => 1e-3;
60+
protected override double MicrowattsPerSquareMeterInOneWattPerSquareMeter => 1e6;
61+
protected override double MilliwattsPerSquareMeterInOneWattPerSquareMeter => 1e3;
62+
protected override double NanowattsPerSquareMeterInOneWattPerSquareMeter => 1e9;
63+
protected override double WattsPerSquareFootInOneWattPerSquareMeter => 9.290304e-2;
64+
protected override double WattsPerSquareInchInOneWattPerSquareMeter => 6.4516e-4;
65+
protected override double WattsPerSquareMeterInOneWattPerSquareMeter => 1;
66+
67+
[Fact]
68+
public void PowerDividedByAreaEqualsHeatFlux()
69+
{
70+
HeatFlux heatFlux = Power.FromWatts(12) / Area.FromSquareMeters(3);
71+
Assert.Equal(heatFlux, HeatFlux.FromWattsPerSquareMeter(4));
72+
}
73+
74+
[Fact]
75+
public void HeatFluxTimesAreaEqualsPower()
76+
{
77+
Power power = HeatFlux.FromWattsPerSquareMeter(3) * Area.FromSquareMeters(4);
78+
Assert.Equal(power, Power.FromWatts(12));
79+
}
80+
81+
[Fact]
82+
public void PowerDividedByHeatFluxEqualsArea()
83+
{
84+
Area area = Power.FromWatts(12) / HeatFlux.FromWattsPerSquareMeter(3);
85+
Assert.Equal(area, Area.FromSquareMeters(4));
86+
}
87+
}
88+
}

0 commit comments

Comments
 (0)