gentest for Java and C#
Summary: - Revise scripts to generate Java and C# unittests using the same HTML fixtures as well as C for code coverage. - Add wrap_column test workaround in gentest.js. - Add checkDefaultValues for sanity check of the CSSLayout default values by test-template.html - Add `align-content: flex-start;` in default div to align with CSSLayout default $ cd csharp/gentest $ ruby gentest.rb - macOS example for C# $ cd csharp/tests/Facebook.CSSLayout $ clang -DCSS_ASSERT_FAIL_ENABLED -Wall -Wextra -dynamiclib -o libCSSLayout.dylib -g -I../../.. ../../../CSSLayout/*.c ../../CSSLayout/CSSInterop.cpp $ mcs -debug -t:library -r:nunit.framework.dll -out:CSSLayoutTest.dll *.cs ../../../csharp/Facebook.CSSLayout/*cs $ mono64 --debug nunit-console.exe CSSLayoutTest.dll Reviewed By: emilsjolander Differential Revision: D4053777 fbshipit-source-id: 84450208015e65baf604987bd56c6a268598b545
This commit is contained in:
committed by
Facebook Github Bot
parent
1488f822c3
commit
dc5e613285
203
gentest/gentest-cpp.js
Normal file
203
gentest/gentest-cpp.js
Normal file
@@ -0,0 +1,203 @@
|
||||
/**
|
||||
* Copyright (c) 2014-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
var CPPEmitter = function() {
|
||||
Emitter.call(this, 'cpp', ' ');
|
||||
};
|
||||
|
||||
CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
constructor:{value:CPPEmitter},
|
||||
|
||||
emitPrologue:{value:function() {
|
||||
this.push([
|
||||
'#include <CSSLayout/CSSLayout.h>',
|
||||
'#include <gtest/gtest.h>',
|
||||
'',
|
||||
]);
|
||||
}},
|
||||
|
||||
emitTestPrologue:{value:function(name) {
|
||||
this.push('TEST(CSSLayoutTest, ' + name + ') {');
|
||||
this.pushIndent();
|
||||
}},
|
||||
|
||||
emitTestTreePrologue:{value:function(nodeName) {
|
||||
this.push('const CSSNodeRef ' + nodeName + ' = CSSNodeNew();');
|
||||
}},
|
||||
|
||||
emitTestEpilogue:{value:function() {
|
||||
this.push([
|
||||
'',
|
||||
'CSSNodeFreeRecursive(root);',
|
||||
]);
|
||||
this.popIndent();
|
||||
this.push([
|
||||
'}',
|
||||
'',
|
||||
]);
|
||||
}},
|
||||
|
||||
emitEpilogue:{value:function() {
|
||||
}},
|
||||
|
||||
AssertEQ:{value:function(v0, v1) {
|
||||
this.push('ASSERT_EQ(' + v0 + ', ' + v1 + ');');
|
||||
}},
|
||||
|
||||
CSSAlignAuto:{value:'CSSAlignAuto'},
|
||||
CSSAlignCenter:{value:'CSSAlignCenter'},
|
||||
CSSAlignFlexEnd:{value:'CSSAlignFlexEnd'},
|
||||
CSSAlignFlexStart:{value:'CSSAlignFlexStart'},
|
||||
CSSAlignStretch:{value:'CSSAlignStretch'},
|
||||
|
||||
CSSDirectionInherit:{value:'CSSDirectionInherit'},
|
||||
CSSDirectionLTR:{value:'CSSDirectionLTR'},
|
||||
CSSDirectionRTL:{value:'CSSDirectionRTL'},
|
||||
|
||||
CSSEdgeBottom:{value:'CSSEdgeBottom'},
|
||||
CSSEdgeEnd:{value:'CSSEdgeEnd'},
|
||||
CSSEdgeLeft:{value:'CSSEdgeLeft'},
|
||||
CSSEdgeRight:{value:'CSSEdgeRight'},
|
||||
CSSEdgeStart:{value:'CSSEdgeStart'},
|
||||
CSSEdgeTop:{value:'CSSEdgeTop'},
|
||||
|
||||
CSSFlexDirectionColumn:{value:'CSSFlexDirectionColumn'},
|
||||
CSSFlexDirectionColumnReverse:{value:'CSSFlexDirectionColumnReverse'},
|
||||
CSSFlexDirectionRow:{value:'CSSFlexDirectionRow'},
|
||||
CSSFlexDirectionRowReverse:{value:'CSSFlexDirectionRowReverse'},
|
||||
|
||||
CSSJustifyCenter:{value:'CSSJustifyCenter'},
|
||||
CSSJustifyFlexEnd:{value:'CSSJustifyFlexEnd'},
|
||||
CSSJustifyFlexStart:{value:'CSSJustifyFlexStart'},
|
||||
CSSJustifySpaceAround:{value:'CSSJustifySpaceAround'},
|
||||
CSSJustifySpaceBetween:{value:'CSSJustifySpaceBetween'},
|
||||
|
||||
CSSOverflowHidden:{value:'CSSOverflowHidden'},
|
||||
CSSOverflowVisible:{value:'CSSOverflowVisible'},
|
||||
|
||||
CSSPositionTypeAbsolute:{value:'CSSPositionTypeAbsolute'},
|
||||
CSSPositionTypeRelative:{value:'CSSPositionTypeRelative'},
|
||||
|
||||
CSSWrapTypeNoWrap:{value:'CSSWrapTypeNoWrap'},
|
||||
CSSWrapTypeWrap:{value:'CSSWrapTypeWrap'},
|
||||
|
||||
CSSUndefined:{value:'CSSUndefined'},
|
||||
|
||||
CSSNodeCalculateLayout:{value:function(node, dir) {
|
||||
this.push('CSSNodeCalculateLayout(' + node + ', CSSUndefined, CSSUndefined, ' + dir + ');');
|
||||
}},
|
||||
|
||||
CSSNodeInsertChild:{value:function(parentName, nodeName, index) {
|
||||
this.push('CSSNodeInsertChild(' + parentName + ', ' + nodeName + ', ' + index + ');');
|
||||
}},
|
||||
|
||||
CSSNodeLayoutGetLeft:{value:function(nodeName) {
|
||||
return 'CSSNodeLayoutGetLeft(' + nodeName + ')';
|
||||
}},
|
||||
|
||||
CSSNodeLayoutGetTop:{value:function(nodeName) {
|
||||
return 'CSSNodeLayoutGetTop(' + nodeName + ')';
|
||||
}},
|
||||
|
||||
CSSNodeLayoutGetWidth:{value:function(nodeName) {
|
||||
return 'CSSNodeLayoutGetWidth(' + nodeName + ')';
|
||||
}},
|
||||
|
||||
CSSNodeLayoutGetHeight:{value:function(nodeName) {
|
||||
return 'CSSNodeLayoutGetHeight(' + nodeName + ')';
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetAlignContent:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetAlignContent(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetAlignItems:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetAlignItems(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetAlignSelf:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetAlignSelf(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetBorder:{value:function(nodeName, edge, value) {
|
||||
this.push('CSSNodeStyleSetBorder(' + nodeName + ', ' + edge + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetDirection:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetDirection(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetFlexBasis:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetFlexBasis(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetFlexDirection:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetFlexDirection(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetFlexGrow:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetFlexGrow(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetFlexShrink:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetFlexShrink(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetFlexWrap:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetFlexWrap(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetHeight:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetHeight(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetJustifyContent:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetJustifyContent(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetMargin:{value:function(nodeName, edge, value) {
|
||||
this.push('CSSNodeStyleSetMargin(' + nodeName + ', ' + edge + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetMaxHeight:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetMaxHeight(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetMaxWidth:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetMaxWidth(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetMinHeight:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetMinHeight(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetMinWidth:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetMinWidth(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetOverflow:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetOverflow(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetPadding:{value:function(nodeName, edge, value) {
|
||||
this.push('CSSNodeStyleSetPadding(' + nodeName + ', ' + edge + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetPosition:{value:function(nodeName, edge, value) {
|
||||
this.push('CSSNodeStyleSetPosition(' + nodeName + ', ' + edge + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetPositionType:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetPositionType(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
|
||||
CSSNodeStyleSetWidth:{value:function(nodeName, value) {
|
||||
this.push('CSSNodeStyleSetWidth(' + nodeName + ', ' + value + ');');
|
||||
}},
|
||||
});
|
Reference in New Issue
Block a user