本文整理汇总了Java中org.fest.assertions.Delta类的典型用法代码示例。如果您正苦于以下问题:Java Delta类的具体用法?Java Delta怎么用?Java Delta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Delta类属于org.fest.assertions包,在下文中一共展示了Delta类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: shouldHandleRenamedFilesProperlyOverSeveralCommitsByDay
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
@Ignore
public void shouldHandleRenamedFilesProperlyOverSeveralCommitsByDay() throws CodeChurnCalculationException, ScmConnectionEncodingException {
ScmConnectionSettings connectionSettings = new ScmConnectionSettings("http://svn.apache.org/repos/asf/commons/proper/configuration/trunk/src/main/java");
Collection<DailyCodeChurn> codeChurns = codeChurnCalculator.calculateCodeChurn(connectionSettings,
"org/apache/commons/configuration/reloading/ManagedReloadingDetector.java", new LocalDate(2013, 5, 6), 36); // until 2013-04-01
assertThat(codeChurns).hasSize(37);
DailyCodeChurn fifthMay = getCodeChurnByDay(codeChurns, new LocalDate(2013, 5, 5));
assertThat(fifthMay.getCodeChurnProportions()).hasSize(1);
assertThat(fifthMay.getCodeChurnProportions().get(0)).isEqualTo(0.0563, Delta.delta(0.0001));
DailyCodeChurn forthApril = getCodeChurnByDay(codeChurns, new LocalDate(2013, 4, 4));
assertThat(forthApril.getCodeChurnProportions()).hasSize(1);
assertThat(forthApril.getCodeChurnProportions().get(0)).isEqualTo(0.1126, Delta.delta(0.0001));
}
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:17,代码来源:SvnCodeChurnCalculatorServiceIntegrationTest.java
示例2: codeChurnForFiveDayPeriod
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void codeChurnForFiveDayPeriod() throws CodeChurnCalculationException, ScmConnectionEncodingException {
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(LocalDate.now(), Arrays.asList(0.8, 0.4, 0.1)));
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(LocalDate.now().minusDays(1), Arrays.asList(0.2, 0.1)));
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(LocalDate.now().minusDays(2), Arrays.asList(0.01, 0.23)));
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(LocalDate.now().minusDays(3), Arrays.asList(0.33, 0.004)));
// on the fourth day nothing happened
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(LocalDate.now().minusDays(5), Arrays.asList(1.0)));
final double expectedSumOfCodeChurnProportions = 0.133333 + 0.06666666666667 + 0.01666666666667
+ 0.03333333333333 + 0.01666666666667
+ 0.00166666666667 + 0.03833333333333
+ 0.055 + 0.00066666666667
+ 0.16666666666667;
CodeChangeProbabilityCalculator codeChangeProbabilityCalculator = new DefaultCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, startDay, 5);
assertThat(codeChangeProbabilityCalculator.calculateCodeChangeProbability(dummyConnectionSettings, "A"))
.isEqualTo(expectedSumOfCodeChurnProportions, Delta.delta(0.001));
}
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:20,代码来源:DefaultCodeChangeProbabilityCalculatorTest.java
示例3: codeChurnForFiveDayPeriod
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void codeChurnForFiveDayPeriod() throws CodeChurnCalculationException, ScmConnectionEncodingException {
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(startDay, Arrays.asList(0.8, 0.1)));
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(startDay.minusDays(1), Arrays.asList(0.1)));
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(startDay.minusDays(2), Arrays.asList(0.23)));
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(startDay.minusDays(3), Arrays.asList(0.33, 0.004)));
// on the fourth day nothing happened
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(LocalDate.now().minusDays(5), Arrays.asList(1.0)));
final double expectedSumOfCodeChurnProportions = 0.306796785456 + 0.038349598181547084
+ 0.027051861681
+ 0.042133988029
+ 0.03837934168987 + 0.000465
+ 0.027777;
CodeChangeProbabilityCalculator codeChangeProbabilityCalculator = new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, startDay, 5);
assertThat(codeChangeProbabilityCalculator.calculateCodeChangeProbability(dummyConnectionSettings, "A"))
.isEqualTo(expectedSumOfCodeChurnProportions, Delta.delta(0.001));
}
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:20,代码来源:WeightedCodeChangeProbabilityCalculatorTest.java
示例4: testVerify
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void testVerify() throws Exception {
PageWithType page1 = new PageWithType() {{ setTitle("Test"); setWikiText("Wikitext"); setType("character"); }};
PageWithType page2 = new PageWithType() {{ setTitle("Test2"); setWikiText("Wikitext"); setType("bar"); }};
PageWithType page3 = new PageWithType() {{ setTitle("Test3"); setWikiText("Wikitext"); setType("foo"); }};
ClassificationResult result1 = new ClassificationResult("character", Lists.<ClassRelevance>newArrayList());
ClassificationResult result2 = new ClassificationResult("bad_type", Lists.<ClassRelevance>newArrayList());
ClassificationResult result3 = new ClassificationResult("foo", Lists.<ClassRelevance>newArrayList());
Classifier classifier = mock(Classifier.class);
when(classifier.classify(page1)).thenReturn(result1);
when(classifier.classify(page2)).thenReturn(result2);
when(classifier.classify(page3)).thenReturn(result3);
DefaultClassifierVerifier subject = new DefaultClassifierVerifier();
ClassifierTrainingResult verify = subject.verify(classifier, Lists.newArrayList(page1, page2, page3));
assertThat(verify.getClassifier()).isEqualTo(classifier);
assertThat(verify.getSuccessRate()).isEqualTo(0.66666, Delta.delta(0.01));
assertThat(verify.getClassificationResultPairList().get(1).getResult().getSingleClass()).isEqualTo("bad_type");
assertThat(verify.getClassificationResultPairList().get(1).getPage().getType()).isEqualTo("bar");
}
开发者ID:ArturD,项目名称:holmes,代码行数:24,代码来源:DefaultClassifierVerifierTest.java
示例5: shouldProperActivatePerceptronBasedOnConcreteValues
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void shouldProperActivatePerceptronBasedOnConcreteValues() throws Exception {
/*
* as on the first layer in example
* http://www.nnwj.de/backpropagation.html
*/
// given
Perceptron perceptron1=new Perceptron(newArrayList(0.62,0.55));
Perceptron perceptron2=new Perceptron(newArrayList(0.42,-0.17));
perceptron1.setActivationFunction(new SigmoidActivationFunction());
perceptron1.setBias(0.0);
perceptron2.setActivationFunction(new SigmoidActivationFunction());
perceptron2.setBias(0.0);
// when
Double output1=perceptron1.feedForward(newArrayList(0.0,1.0));
Double output2=perceptron2.feedForward(newArrayList(0.0,1.0));
//then
assertThat(output1).isEqualTo(0.634135591,Delta.delta(0.000000001));
assertThat(output2).isEqualTo(0.457602059,Delta.delta(0.000000001));
}
开发者ID:zdanowiczkonrad,项目名称:BrailleRecognition,代码行数:27,代码来源:PerceptronTest.java
示例6: shouldPerformFeedForwardOnAllLayers
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void shouldPerformFeedForwardOnAllLayers() throws InputOrWeightSizeException {
/**
* This test covers the first input from example at
* http://www.nnwj.de/backpropagation.html
*/
// given
Network network = createTwoLayerNetworkWithoutBiases();
// when
List<Double> input = newArrayList(0.0, 1.0);
List<Double> expected = newArrayList(0.643962658);
// then
assertDoubleArraysEqualWithDelta(network.feedForward(input), expected, Delta.delta(0.000000001));
// when
input = newArrayList(1.0, 1.0);
expected = newArrayList(0.673149314);
// then
assertDoubleArraysEqualWithDelta(network.feedForward(input), expected, Delta.delta(0.000000001));
}
开发者ID:zdanowiczkonrad,项目名称:BrailleRecognition,代码行数:26,代码来源:GenericMultiLayerNetworkTest.java
示例7: shouldReturnZeroWhenMeasuredPositionIsThreeAndOneHalfRotationAndVelocityAreZero
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void shouldReturnZeroWhenMeasuredPositionIsThreeAndOneHalfRotationAndVelocityAreZero() {
analogPosition = (int)(1024 * 3.5) - 1;
analogTurnsOverVoltageRange = 1;
createSensor();
assertThat(sensor.getAngle()).isEqualTo(1260.0d, DELTA);
assertThat(sensor.getHeading()).isEqualTo(180.0d, DELTA);
assertThat(sensor.getRate()).isEqualTo(0.0d, DELTA);
assertThat(sensor.rawPositionForAngleInDegrees(1260.0d)).isEqualTo(analogPosition, Delta.delta(5.0));
}
开发者ID:strongback,项目名称:strongback-java,代码行数:11,代码来源:HardwareTalonSRX_AnalogInputSensorTest.java
示例8: shouldHandleMeasuredPositionAndVelocity
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void shouldHandleMeasuredPositionAndVelocity() {
analogPosition = (int)(1024 * 3.5) - 1;
analogVelocity = 1023; // starts from 0 and does full rotation
analogTurnsOverVoltageRange = 1;
createSensor();
assertThat(sensor.getAngle()).isEqualTo(1260.0d, DELTA);
assertThat(sensor.getHeading()).isEqualTo(180.0d, DELTA);
assertThat(sensor.getRate()).isEqualTo(360.0 / cyclePeriodInSeconds, DELTA); // degrees per second
assertThat(sensor.rawPositionForAngleInDegrees(1260.0d)).isEqualTo(analogPosition, Delta.delta(5.0));
}
开发者ID:strongback,项目名称:strongback-java,代码行数:12,代码来源:HardwareTalonSRX_AnalogInputSensorTest.java
示例9: assertStoppedAtReverseLimit
import org.fest.assertions.Delta; //导入依赖的package包/类
protected void assertStoppedAtReverseLimit() {
assertThat(limited.getSpeed()).isEqualTo(0.0,Delta.delta(0.00001));
//assertThat(limited.isAtForwardLimit()).isEqualTo(false); // not necessarily the case in all situations
assertThat(limited.isAtReverseLimit()).isEqualTo(true);
assertThat(limited.getPosition()).isEqualTo(Position.REVERSE_LIMIT);
assertThat(limited.getDirection()).isEqualTo(Direction.STOPPED);
}
开发者ID:strongback,项目名称:strongback-java,代码行数:8,代码来源:LimitedMotorTest.java
示例10: assertStoppedAtUnknonwPosition
import org.fest.assertions.Delta; //导入依赖的package包/类
protected void assertStoppedAtUnknonwPosition() {
assertThat(limited.getSpeed()).isEqualTo(0.0,Delta.delta(0.00001));
//assertThat(limited.isAtForwardLimit()).isEqualTo(false); // not necessarily the case in all situations
assertThat(limited.isAtReverseLimit()).isEqualTo(true);
assertThat(limited.getPosition()).isEqualTo(Position.UNKNOWN);
assertThat(limited.getDirection()).isEqualTo(Direction.STOPPED);
}
开发者ID:strongback,项目名称:strongback-java,代码行数:8,代码来源:LimitedMotorTest.java
示例11: should_calculate_target_angle_1
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void should_calculate_target_angle_1() {
Targeter targeter = new Targeter();
targeter.setOwnLocation(new Coordinate(0d, 0d, 0L), 0d);
assertThat(targeter.calculateAngleTowards(new Coordinate(1d, 0d, 0L))).isEqualTo(0d, Delta.delta(1E-04));
assertThat(targeter.calculateAngleTowards(new Coordinate(-1d, 0d, 0L))).isEqualTo(Math.toRadians(180), Delta.delta(1E-04));
assertThat(targeter.calculateAngleTowards(new Coordinate(0d, 1d, 0L))).isEqualTo(Math.toRadians(90), Delta.delta(1E-04));
assertThat(targeter.calculateAngleTowards(new Coordinate(0d, -1d, 0L))).isEqualTo(Math.toRadians(270), Delta.delta(1E-04));
}
开发者ID:brain-bugs,项目名称:Klendathu,代码行数:10,代码来源:TargeterTest.java
示例12: should_calculate_target_angle_2
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void should_calculate_target_angle_2() {
Targeter targeter = new Targeter();
targeter.setOwnLocation(new Coordinate(-1d, 2d, 0L), 0.25d * Math.PI);
assertThat(targeter.calculateAngleTowards(new Coordinate(2d, 5d, 0L))).isEqualTo(0d, Delta.delta(1E-04));
assertThat(targeter.calculateAngleTowards(new Coordinate(-2d, 3d, 0L))).isEqualTo(Math.toRadians(90), Delta.delta(1E-04));
assertThat(targeter.calculateAngleTowards(new Coordinate(-2d, 1d, 0L))).isEqualTo(Math.toRadians(180), Delta.delta(1E-04));
assertThat(targeter.calculateAngleTowards(new Coordinate(2d, -1d, 0L))).isEqualTo(Math.toRadians(270), Delta.delta(1E-04));
}
开发者ID:brain-bugs,项目名称:Klendathu,代码行数:10,代码来源:TargeterTest.java
示例13: shouldCalculateAllCodeChurnProportionsForOneDayAndOneFile
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void shouldCalculateAllCodeChurnProportionsForOneDayAndOneFile() throws CodeChurnCalculationException, ScmConnectionEncodingException {
// TODO improve this test with vagrant and puppet and own svn repository server via vm
ScmConnectionSettings connectionSettings = new ScmConnectionSettings("http://rapla.googlecode.com/svn/trunk/src/");
Collection<DailyCodeChurn> codeChurns = codeChurnCalculator.calculateCodeChurn(connectionSettings,
"org/rapla/server/internal/SecurityManager.java",
new LocalDate(2013, 5, 17), 0);
assertThat(codeChurns).hasSize(1);
DailyCodeChurn codeChurn = codeChurns.iterator().next();
assertThat(codeChurn.getCodeChurnProportions().get(0)).isEqualTo(0.0719, Delta.delta(0.0001));
assertThat(codeChurn.getCodeChurnProportions().get(1)).isEqualTo(0.0111, Delta.delta(0.0001));
}
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:14,代码来源:SvnCodeChurnCalculatorServiceIntegrationTest.java
示例14: shouldHandleRenamedFilesProperlyForOneCommitByDay
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void shouldHandleRenamedFilesProperlyForOneCommitByDay() throws CodeChurnCalculationException, ScmConnectionEncodingException {
ScmConnectionSettings connectionSettings = new ScmConnectionSettings("http://svn.apache.org/repos/asf/commons/proper/configuration/trunk/src/main/java");
Collection<DailyCodeChurn> codeChurns = codeChurnCalculator.calculateCodeChurn(connectionSettings,
"org/apache/commons/configuration/reloading/ManagedReloadingDetector.java", new LocalDate(2013, 5, 5), 0);
assertThat(codeChurns).hasSize(1);
DailyCodeChurn fifthMay = getCodeChurnByDay(codeChurns, new LocalDate(2013, 5, 5));
assertThat(fifthMay.getCodeChurnProportions()).hasSize(1);
assertThat(fifthMay.getCodeChurnProportions().get(0)).isEqualTo(0.0563, Delta.delta(0.0001));
}
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:12,代码来源:SvnCodeChurnCalculatorServiceIntegrationTest.java
示例15: codeChurnForOneDayPeriod
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void codeChurnForOneDayPeriod() throws CodeChurnCalculationException, ScmConnectionEncodingException {
fakeCodeChurnCalculator.addCodeChurn("A", new DailyCodeChurn(startDay, Arrays.asList(0.8)));
// no data for yesterday, so only 'today' values count
CodeChangeProbabilityCalculator codeChangeProbabilityCalculator = new WeightedCodeChangeProbabilityCalculator(codeChurnCalculatorFactory, startDay, 1);
assertThat(codeChangeProbabilityCalculator.calculateCodeChangeProbability(dummyConnectionSettings, "A"))
.isEqualTo(0.6595, Delta.delta(0.0001));
}
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:9,代码来源:WeightedCodeChangeProbabilityCalculatorTest.java
示例16: shouldDivideProfitOfViolationByWeightingMetricValue
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void shouldDivideProfitOfViolationByWeightingMetricValue() {
ProfitCalculator profitCalculator = mock(ProfitCalculator.class);
when(profitCalculator.calculateProfit(any(QualityViolation.class))).thenReturn(20.0);
QualityViolation violation = mock(QualityViolation.class);
when(violation.getWeightingMetricValue()).thenReturn(13.0);
WeightedProfitCalculator weightedProfitCalculator = new WeightedProfitCalculator(profitCalculator);
assertThat(weightedProfitCalculator.calculateWeightedProfit(violation)).isEqualTo(1.54, Delta.delta(0.01));
}
开发者ID:CodeQInvest,项目名称:codeq-invest,代码行数:12,代码来源:WeightedProfitCalculatorTest.java
示例17: testSample
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void testSample() {
_distribution = new CategorialDistribution(new FixedParameter<List<Double>>(Lists.newArrayList(0.6, 0.3, 0.1)));
_distribution.setSeed(43253);
assertThat(_distribution.sample()).isInstanceOf(DiscreteFeatureValue.class);
List<Integer> samples = Lists.newArrayList();
for (int i = 0; i < 100000; i++) {
samples.add((Integer) _distribution.sample().getValue());
}
double sampleMean = StatisticsTestUtil.sampleMeanFromIntegerList(samples);
assertThat(sampleMean).isEqualTo(0.5, Delta.delta(0.01));
}
开发者ID:FRosner,项目名称:DataGenerator,代码行数:13,代码来源:CategorialDistributionTest.java
示例18: sigmoidActivationFunctionShouldReturnCorrectValue
import org.fest.assertions.Delta; //导入依赖的package包/类
@Test
public void sigmoidActivationFunctionShouldReturnCorrectValue() throws Exception {
// given
ActivationFunction activationFunction = new SigmoidActivationFunction();
// then
assertThat(activationFunction.activate(0.5)).isEqualTo(Double.valueOf(0.6224), Delta.delta(0.0001));
}
开发者ID:zdanowiczkonrad,项目名称:BrailleRecognition,代码行数:9,代码来源:SigmoidActivationFunctionTest.java
示例19: assertDoubleArraysEqualWithDelta
import org.fest.assertions.Delta; //导入依赖的package包/类
private void assertDoubleArraysEqualWithDelta(List<Double> actual, List<Double> expected, Delta delta) {
if (actual.size() != expected.size()) {
fail("Actual has different size than expected");
}
for (int i = 0; i < actual.size(); i++) {
assertThat(actual.get(i)).isEqualTo(expected.get(i), delta);
}
}
开发者ID:zdanowiczkonrad,项目名称:BrailleRecognition,代码行数:9,代码来源:LayerTest.java
示例20: assertNetworkLayerHasFollowingWeights
import org.fest.assertions.Delta; //导入依赖的package包/类
private void assertNetworkLayerHasFollowingWeights(Network network, List<Double> expectedWeights) {
int i = 0;
for (int layerIndex = network.getLayers().size() - 1; layerIndex >= 0; layerIndex--) {
Layer layer = network.getLayers().get(layerIndex);
for (Perceptron perceptron : layer.getPerceptrons()) {
for (Double weight : perceptron.getWeights()) {
Double expected = expectedWeights.get(i++);
assertThat(expected).isEqualTo(weight, Delta.delta(0.000000001));
}
}
}
}
开发者ID:zdanowiczkonrad,项目名称:BrailleRecognition,代码行数:13,代码来源:GenericMultiLayerNetworkTest.java
注:本文中的org.fest.assertions.Delta类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论