Skip to content

Commit

Permalink
Merge pull request #6 from LisiLisenok/develop
Browse files Browse the repository at this point in the history
version 0.5.2
  • Loading branch information
LisiLisenok authored Oct 18, 2016
2 parents ca8db5c + 2fec1b4 commit b045ef8
Show file tree
Hide file tree
Showing 11 changed files with 136 additions and 162 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ The module is available on [CeylonHerd](https://herd.ceylon-lang.org/modules/her

#### Ceylon compiler / platform

Compiled with Ceylon 1.2.2
Compiled with Ceylon 1.3.0
Available on JVM only


#### Dependencies

* ceylon.collection/1.2.2
* ceylon.file/1.2.2
* ceylon.language/1.2.2
* ceylon.promise/1.2.2 shared
* ceylon.test/1.2.2 shared
* ceylon.collection/1.3.0
* ceylon.file/1.3.0
* ceylon.language/1.3.0
* ceylon.promise/1.3.0 shared
* ceylon.test/1.3.0 shared
* java.base/8 JDK


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ sequential class CeylonJavaMapMicrobenchmark() satisfies TestSuite
Plotter javaTreeRemovePlotter = removeChart.addPlot( titles.javaTreeMap );

ChartBuilder hashMapRatioChart = ChartBuilder (
titles.hashMapRatios, titles.categoryTitle, titles.valTitle,
titles.hashMapRatios, titles.categoryTitle, titles.valRatioTitle,
ReportFormat( ", ", 0, 0, 2, 2 )
);
Plotter putHashRatioPlotter = hashMapRatioChart.addPlot( titles.put );
Plotter getHashRatioPlooter = hashMapRatioChart.addPlot( titles.get );
Plotter removeHashRatioPlooter = hashMapRatioChart.addPlot( titles.remove );

ChartBuilder treeMapRatioChart = ChartBuilder (
titles.treeMapRatios, titles.categoryTitle, titles.valTitle,
titles.treeMapRatios, titles.categoryTitle, titles.valRatioTitle,
ReportFormat( ", ", 0, 0, 2, 2 )
);
Plotter putTreeRatioPlotter = treeMapRatioChart.addPlot( titles.put );
Expand Down
41 changes: 21 additions & 20 deletions examples/herd/examples/asynctest/mapperformance/titles.ceylon
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@

"contains titles to be usedto store and retrieve plotters"
object titles {
shared String put = "put";
shared String get = "get";
shared String remove = "remove";

shared String ceylonHashMap = "ceylon hash map";
shared String ceylonTreeMap = "ceylon tree map";
shared String javaHashMap = "java hash map";
shared String javaTreeMap = "java tree map";

shared String hashMapRatios = "HashMap Ceylon / Java ratios";
shared String treeMapRatios = "TreeMap Ceylon / Java ratios";

shared String titlesDelimiter = "-";

shared String categoryTitle = "count";
shared String valTitle = "time, ms";
}

"contains titles to be usedto store and retrieve plotters"
object titles {
shared String put = "put";
shared String get = "get";
shared String remove = "remove";

shared String ceylonHashMap = "ceylon hash map";
shared String ceylonTreeMap = "ceylon tree map";
shared String javaHashMap = "java hash map";
shared String javaTreeMap = "java tree map";

shared String hashMapRatios = "HashMap Ceylon / Java ratios";
shared String treeMapRatios = "TreeMap Ceylon / Java ratios";

shared String titlesDelimiter = "-";

shared String categoryTitle = "count";
shared String valTitle = "time, ms";
shared String valRatioTitle = "Ceylon / Java ratio";
}
14 changes: 7 additions & 7 deletions examples/herd/examples/asynctest/module.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ license (
)
by( "Lis" )
native( "jvm" )
module herd.examples.asynctest "0.5.1" {
shared import ceylon.collection "1.2.2";
shared import ceylon.json "1.2.2";
shared import ceylon.file "1.2.2";
shared import ceylon.promise "1.2.2";
shared import ceylon.test "1.2.2";
shared import herd.asynctest "0.5.1";
module herd.examples.asynctest "0.5.2" {
shared import ceylon.collection "1.3.0";
shared import ceylon.json "1.3.0";
shared import ceylon.file "1.3.0";
shared import ceylon.promise "1.3.0";
shared import ceylon.test "1.3.0";
shared import herd.asynctest "0.5.2";
shared import java.base "8";
}
2 changes: 1 addition & 1 deletion source/herd/asynctest/AsyncTestContext.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import ceylon.promise {
>If `value` is passed to [[assertThat]] or [[assumeThat]] methods the matching operation is performed immediately
and mathods return already fulfilled promise.
and methods return already fulfilled promise.
--------------------------------------------
"
Expand Down
9 changes: 7 additions & 2 deletions source/herd/asynctest/TestGroupExecutor.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import ceylon.language.meta.declaration {
FunctionDeclaration,
ClassDeclaration,
OpenInterfaceType,
Package
Package,
InterfaceDeclaration
}
import ceylon.collection {

Expand All @@ -38,6 +39,10 @@ class TestGroupExecutor (
"Context the group executed on." shared TestExecutionContext groupContext
) {

"Async declaration memoization."
InterfaceDeclaration asyncContextDeclaration = `interface AsyncTestContext`;


"Test event emitter with results collection."
TestResultCollector resultCollector = TestResultCollector( resultEmitter );

Expand Down Expand Up @@ -135,7 +140,7 @@ class TestGroupExecutor (
Boolean isAsyncDeclaration( FunctionDeclaration functionDeclaration ) {
if ( nonempty argDeclarations = functionDeclaration.parameterDeclarations,
is OpenInterfaceType argType = argDeclarations.first.openType,
argType.declaration == `interface AsyncTestContext`
argType.declaration == asyncContextDeclaration
) {
return true;
}
Expand Down
35 changes: 0 additions & 35 deletions source/herd/asynctest/chart/formatFloatToString.ceylon

This file was deleted.

162 changes: 81 additions & 81 deletions source/herd/asynctest/chart/reportChartByLines.ceylon
Original file line number Diff line number Diff line change
@@ -1,81 +1,81 @@


"Reports charts writing line by line:
* line with chart title, category title and value title
* line with plot titles
* lines with points for each plot
Each item is separated using [[ReportFormat.delimiter]] (see [[defaultFormat]]).
Numbers are reported using language [[formatFloat]]
with given decimalPlaces (see [[defaultFormat]]).
"
by( "Lis" )
shared void reportChartByLines (
"Default format used if no format specified in chart." ReportFormat defaultFormat,
"Charts to be reported." Chart[] charts,
"Function used to write a line." void writeLine( String line )
) {
for ( chart in charts ) {
// format used for the current chart
ReportFormat format = if ( exists f = chart.format ) then f else defaultFormat;

// write and empty line
writeLine( "" );

// write chart title, category and value titles
writeLine (
"'chart':" + format.delimiter + chart.title + format.delimiter
+ "'category':" + format.delimiter + chart.categoryTitle + format.delimiter
+ "'value':" + format.delimiter + chart.valueTitle
);

// write plot titles
StringBuilder builder = StringBuilder();
Integer delimSize = format.delimiter.size;
for ( plot in chart.plots ) {
builder.append( plot.title );
builder.append( format.delimiter );
builder.append( format.delimiter );
}
variable String line = builder.string;
while ( line.endsWith( format.delimiter ) ) {
line = line.spanTo( line.size - delimSize - 1 );
}
writeLine( line );

// write plot points
if ( exists maxLines = max( {for ( plot in chart.plots ) plot.points.size} ) ) {
variable Integer current = 0;
while ( current < maxLines ) {
builder.clear();
for ( plot in chart.plots ) {
if ( exists pt = plot.points[current] ) {
builder.append (
formatFloatToString (
pt.category, format.minCategoryDecimalPlaces, format.maxCategoryDecimalPlaces
)
);
builder.append( format.delimiter );
builder.append (
formatFloatToString (
pt.val, format.minValueDecimalPlaces, format.maxValueDecimalPlaces
)
);
builder.append( format.delimiter );
}
else {
builder.append( format.delimiter );
builder.append( format.delimiter );
}
}
line = builder.string;
while ( line.endsWith( format.delimiter ) ) {
line = line.spanTo( line.size - delimSize - 1 );
}
writeLine( line );
current ++;
}
}

}
}


"Reports charts writing line by line:
* line with chart title, category title and value title
* line with plot titles
* lines with points for each plot
Each item is separated using [[ReportFormat.delimiter]] (see [[defaultFormat]]).
Numbers are reported using language [[formatFloat]]
with given decimalPlaces (see [[defaultFormat]]).
"
by( "Lis" )
shared void reportChartByLines (
"Default format used if no format specified in chart." ReportFormat defaultFormat,
"Charts to be reported." Chart[] charts,
"Function used to write a line." void writeLine( String line )
) {
for ( chart in charts ) {
// format used for the current chart
ReportFormat format = if ( exists f = chart.format ) then f else defaultFormat;

// write and empty line
writeLine( "" );

// write chart title, category and value titles
writeLine (
"'chart':" + format.delimiter + chart.title + format.delimiter
+ "'category':" + format.delimiter + chart.categoryTitle + format.delimiter
+ "'value':" + format.delimiter + chart.valueTitle
);

// write plot titles
StringBuilder builder = StringBuilder();
Integer delimSize = format.delimiter.size;
for ( plot in chart.plots ) {
builder.append( plot.title );
builder.append( format.delimiter );
builder.append( format.delimiter );
}
variable String line = builder.string;
while ( line.endsWith( format.delimiter ) ) {
line = line.spanTo( line.size - delimSize - 1 );
}
writeLine( line );

// write plot points
if ( exists maxLines = max( {for ( plot in chart.plots ) plot.points.size} ) ) {
variable Integer current = 0;
while ( current < maxLines ) {
builder.clear();
for ( plot in chart.plots ) {
if ( exists pt = plot.points[current] ) {
builder.append (
formatFloat (
pt.category, format.minCategoryDecimalPlaces, format.maxCategoryDecimalPlaces
)
);
builder.append( format.delimiter );
builder.append (
formatFloat (
pt.val, format.minValueDecimalPlaces, format.maxValueDecimalPlaces
)
);
builder.append( format.delimiter );
}
else {
builder.append( format.delimiter );
builder.append( format.delimiter );
}
}
line = builder.string;
while ( line.endsWith( format.delimiter ) ) {
line = line.spanTo( line.size - delimSize - 1 );
}
writeLine( line );
current ++;
}
}

}
}
4 changes: 2 additions & 2 deletions source/herd/asynctest/match/Matcher.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
which identifies if submitted test value satisfies this rule or not.
Verification is performed using [[Matcher.match]] method. Result of verification
isrepresented using [[MatchResult]].
is represented using [[MatchResult]].
Matchers may be combined with each other using `and`, `or` and `xor` methods of [[Matcher]] interface.
Expand All @@ -13,7 +13,7 @@
by( "Lis" )
shared interface Matcher<in Value> {

"Returns `null` if `val` matches this matcher otherwise returns unMatchResult message."
"Returns [[MatchResult]] which contains `Boolean` result (accepted or rejected) and message."
shared formal MatchResult match( Value val );


Expand Down
2 changes: 1 addition & 1 deletion source/herd/asynctest/match/comparableMatchers.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ shared class CloseTo<Value> (
{
shared actual MatchResult match( Value val )
=> MatchResult (
"``stringify( val )`` is close to ``stringify( merit )`` with tolerance ``tolerance``",
"``stringify( val )`` is close to ``stringify( merit )`` with tolerance of ``tolerance``",
( val - merit ).magnitude < tolerance
);

Expand Down
13 changes: 8 additions & 5 deletions source/herd/asynctest/module.ceylon
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
4. Run test in IDE or command line using Ceylon test tool.
>Both modules ceylon.test and herd.asynctest have to be imported to run testing
>Test executor blocks the thread until [[AsyncTestContext.complete]] is called. It means test function
has to notify completion to continue with other testing and to report results.
Expand Down Expand Up @@ -230,10 +233,10 @@ license (
)
by( "Lis" )
native( "jvm" )
module herd.asynctest "0.5.1" {
module herd.asynctest "0.5.2" {
import java.base "8";
shared import ceylon.test "1.2.2";
import ceylon.collection "1.2.2";
import ceylon.file "1.2.2";
shared import ceylon.promise "1.2.2";
shared import ceylon.test "1.3.0";
import ceylon.collection "1.3.0";
import ceylon.file "1.3.0";
shared import ceylon.promise "1.3.0";
}

0 comments on commit b045ef8

Please sign in to comment.