Best JavaScript code snippet using storybook-root
report.js
Source:report.js
...519formatter.step({520 "name": "processing:",521 "keyword": "When ",522 "doc_string": {523 "value": "#define X \u003d TestFunctionReturnsWhatIsPassed(ZZZ) \nThis is X"524 }525});526formatter.match({527 "location": "StepDefinitions.processing(String)"528});529formatter.result({530 "status": "passed"531});532formatter.step({533 "name": "result is:",534 "keyword": "Then ",535 "doc_string": {536 "value": "This is ZZZ"537 }538});539formatter.match({540 "location": "StepDefinitions.result_is(String)"541});542formatter.result({543 "status": "passed"544});545formatter.after({546 "status": "passed"547});548formatter.after({549 "status": "passed"550});551formatter.after({552 "status": "passed"553});554formatter.after({555 "status": "passed"556});557formatter.after({558 "status": "passed"559});560formatter.after({561 "status": "passed"562});563formatter.after({564 "status": "passed"565});566formatter.background({567 "name": "",568 "description": "",569 "keyword": "Background"570});571formatter.before({572 "status": "passed"573});574formatter.before({575 "status": "passed"576});577formatter.before({578 "status": "passed"579});580formatter.before({581 "status": "passed"582});583formatter.before({584 "status": "passed"585});586formatter.before({587 "status": "passed"588});589formatter.before({590 "status": "passed"591});592formatter.step({593 "name": "add local function:",594 "rows": [595 {596 "cells": [597 "Name"598 ]599 },600 {601 "cells": [602 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"603 ]604 },605 {606 "cells": [607 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"608 ]609 },610 {611 "cells": [612 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"613 ]614 }615 ],616 "keyword": "When "617});618formatter.match({619 "location": "StepDefinitions.add_local_function(NameInput\u003e)"620});621formatter.result({622 "status": "passed"623});624formatter.scenario({625 "name": "Local Function Not There",626 "description": "",627 "keyword": "Scenario"628});629formatter.step({630 "name": "processing:",631 "keyword": "When ",632 "doc_string": {633 "value": "#define X \u003d NotALocalFunction()\nThis is X"634 }635});636formatter.match({637 "location": "StepDefinitions.processing(String)"638});639formatter.result({640 "status": "passed"641});642formatter.step({643 "name": "result is:",644 "keyword": "Then ",645 "doc_string": {646 "value": "This is NotALocalFunction()"647 }648});649formatter.match({650 "location": "StepDefinitions.result_is(String)"651});652formatter.result({653 "status": "passed"654});655formatter.after({656 "status": "passed"657});658formatter.after({659 "status": "passed"660});661formatter.after({662 "status": "passed"663});664formatter.after({665 "status": "passed"666});667formatter.after({668 "status": "passed"669});670formatter.after({671 "status": "passed"672});673formatter.after({674 "status": "passed"675});676formatter.background({677 "name": "",678 "description": "",679 "keyword": "Background"680});681formatter.before({682 "status": "passed"683});684formatter.before({685 "status": "passed"686});687formatter.before({688 "status": "passed"689});690formatter.before({691 "status": "passed"692});693formatter.before({694 "status": "passed"695});696formatter.before({697 "status": "passed"698});699formatter.before({700 "status": "passed"701});702formatter.step({703 "name": "add local function:",704 "rows": [705 {706 "cells": [707 "Name"708 ]709 },710 {711 "cells": [712 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"713 ]714 },715 {716 "cells": [717 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"718 ]719 },720 {721 "cells": [722 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"723 ]724 }725 ],726 "keyword": "When "727});728formatter.match({729 "location": "StepDefinitions.add_local_function(NameInput\u003e)"730});731formatter.result({732 "status": "passed"733});734formatter.scenario({735 "name": "Difference in Days",736 "description": "",737 "keyword": "Scenario"738});739formatter.step({740 "name": "processing:",741 "keyword": "When ",742 "doc_string": {743 "value": "#define TODAY \u003d Today()\n#define THREE_DAYS_FROM_NOW \u003d TodayOffsetBy(3) \n#define DIFFERENCE \u003d DaysDifference(TODAY,THREE_DAYS_FROM_NOW) \nDifference is DIFFERENCE"744 }745});746formatter.match({747 "location": "StepDefinitions.processing(String)"748});749formatter.result({750 "status": "passed"751});752formatter.step({753 "name": "result is:",754 "keyword": "Then ",755 "doc_string": {756 "value": "Difference is 3"757 }758});759formatter.match({760 "location": "StepDefinitions.result_is(String)"761});762formatter.result({763 "status": "passed"764});765formatter.after({766 "status": "passed"767});768formatter.after({769 "status": "passed"770});771formatter.after({772 "status": "passed"773});774formatter.after({775 "status": "passed"776});777formatter.after({778 "status": "passed"779});780formatter.after({781 "status": "passed"782});783formatter.after({784 "status": "passed"785});786formatter.uri("features/Main.feature");787formatter.feature({788 "name": "Main Program",789 "description": "",790 "keyword": "Feature"791});792formatter.background({793 "name": "",794 "description": "",795 "keyword": "Background"796});797formatter.before({798 "status": "passed"799});800formatter.before({801 "status": "passed"802});803formatter.before({804 "status": "passed"805});806formatter.before({807 "status": "passed"808});809formatter.before({810 "status": "passed"811});812formatter.before({813 "status": "passed"814});815formatter.before({816 "status": "passed"817});818formatter.step({819 "name": "delete feature output",820 "keyword": "Given "821});822formatter.match({823 "location": "StepDefinitionsMain.delete_feature_output()"824});825formatter.result({826 "status": "passed"827});828formatter.scenario({829 "name": "Full Program",830 "description": "",831 "keyword": "Scenario"832});833formatter.step({834 "name": "include file TestInclude.txt exists with:",835 "keyword": "Given ",836 "doc_string": {837 "value": "#define X 1\n#define Y \u003d X + 3\n"838 }839});840formatter.match({841 "location": "StepDefinitionsMain.include_file_TestInclude_txt_exists_with(Pathname,String)"842});843formatter.result({844 "status": "passed"845});846formatter.step({847 "name": "include file TestCSV.csv exists with:",848 "keyword": "Given ",849 "doc_string": {850 "value": "FieldOne, FieldTwo\n1,2\n"851 }852});853formatter.match({854 "location": "StepDefinitionsMain.include_file_TestInclude_txt_exists_with(Pathname,String)"855});856formatter.result({857 "status": "passed"858});859formatter.step({860 "name": "feature file TestFeature.feature exists with:",861 "keyword": "Given ",862 "doc_string": {863 "value": "Feature: Test Feature\n#include \"TestInclude.txt\" \nScenario: One\nGiven value is X\nWhen processed\nThen result is Y\nScenario Outline: Two \nGiven value is \u003cFieldOne\u003e\nWhen processed \nThen result is \u003cFieldTwo\u003e \nExamples:\n#include \"TestCSV.csv\"\n"864 }865});866formatter.match({867 "location": "StepDefinitionsMain.feature_TestFeature_feature_exists_with(Pathname,String)"868});869formatter.result({870 "status": "passed"871});872formatter.step({873 "name": "main program run",874 "keyword": "When "875});876formatter.match({877 "location": "StepDefinitionsMain.main_program_run()"878});879formatter.result({880 "status": "passed"881});882formatter.step({883 "name": "feature file TestFeature.feature contains",884 "keyword": "Then ",885 "doc_string": {886 "value": "Feature: Test Feature\nScenario: One\nGiven value is 1\nWhen processed\nThen result is 4\nScenario Outline: Two \nGiven value is \u003cFieldOne\u003e\nWhen processed \nThen result is \u003cFieldTwo\u003e \nExamples:\n|FieldOne|FieldTwo|\n|1|2|\n"887 }888});889formatter.match({890 "location": "StepDefinitionsMain.feature_TestFeature_feature_contains(Pathname,String)"891});892formatter.result({893 "status": "passed"894});895formatter.after({896 "status": "passed"897});898formatter.after({899 "status": "passed"900});901formatter.after({902 "status": "passed"903});904formatter.after({905 "status": "passed"906});907formatter.after({908 "status": "passed"909});910formatter.after({911 "status": "passed"912});913formatter.after({914 "status": "passed"915});916formatter.background({917 "name": "",918 "description": "",919 "keyword": "Background"920});921formatter.before({922 "status": "passed"923});924formatter.before({925 "status": "passed"926});927formatter.before({928 "status": "passed"929});930formatter.before({931 "status": "passed"932});933formatter.before({934 "status": "passed"935});936formatter.before({937 "status": "passed"938});939formatter.before({940 "status": "passed"941});942formatter.step({943 "name": "delete feature output",944 "keyword": "Given "945});946formatter.match({947 "location": "StepDefinitionsMain.delete_feature_output()"948});949formatter.result({950 "status": "passed"951});952formatter.scenario({953 "name": "Full Program with nested features and includes",954 "description": "",955 "keyword": "Scenario"956});957formatter.step({958 "name": "include file /folder/TestInclude.txt exists with:",959 "keyword": "Given ",960 "doc_string": {961 "value": "#define X 1\n#define Y \u003d X + 3\n"962 }963});964formatter.match({965 "location": "StepDefinitionsMain.include_file_TestInclude_txt_exists_with(Pathname,String)"966});967formatter.result({968 "status": "passed"969});970formatter.step({971 "name": "feature file folder/TestFeature.feature exists with:",972 "keyword": "Given ",973 "doc_string": {974 "value": "Feature: Test Feature\n#include \"folder/TestInclude.txt\" \nGiven value is X\nWhen processed\nThen result is Y\n"975 }976});977formatter.match({978 "location": "StepDefinitionsMain.feature_TestFeature_feature_exists_with(Pathname,String)"979});980formatter.result({981 "status": "passed"982});983formatter.step({984 "name": "main program run",985 "keyword": "When "986});987formatter.match({988 "location": "StepDefinitionsMain.main_program_run()"989});990formatter.result({991 "status": "passed"992});993formatter.step({994 "name": "feature file folder/TestFeature.feature contains",995 "keyword": "Then ",996 "doc_string": {997 "value": "Feature: Test Feature\nGiven value is 1\nWhen processed\nThen result is 4\n"998 }999});1000formatter.match({1001 "location": "StepDefinitionsMain.feature_TestFeature_feature_contains(Pathname,String)"1002});1003formatter.result({1004 "status": "passed"1005});1006formatter.after({1007 "status": "passed"1008});1009formatter.after({1010 "status": "passed"1011});1012formatter.after({1013 "status": "passed"1014});1015formatter.after({1016 "status": "passed"1017});1018formatter.after({1019 "status": "passed"1020});1021formatter.after({1022 "status": "passed"1023});1024formatter.after({1025 "status": "passed"1026});1027formatter.background({1028 "name": "",1029 "description": "",1030 "keyword": "Background"1031});1032formatter.before({1033 "status": "passed"1034});1035formatter.before({1036 "status": "passed"1037});1038formatter.before({1039 "status": "passed"1040});1041formatter.before({1042 "status": "passed"1043});1044formatter.before({1045 "status": "passed"1046});1047formatter.before({1048 "status": "passed"1049});1050formatter.before({1051 "status": "passed"1052});1053formatter.step({1054 "name": "delete feature output",1055 "keyword": "Given "1056});1057formatter.match({1058 "location": "StepDefinitionsMain.delete_feature_output()"1059});1060formatter.result({1061 "status": "passed"1062});1063formatter.scenario({1064 "name": "Delete files",1065 "description": "",1066 "keyword": "Scenario"1067});1068formatter.step({1069 "name": "feature out file TestFeature.feature exists with:",1070 "keyword": "Given ",1071 "doc_string": {1072 "value": "Feature: Test Feature\nGiven value is X\n"1073 }1074});1075formatter.match({1076 "location": "StepDefinitionsMain.feature_out_exists_with(Pathname,String)"1077});1078formatter.result({1079 "status": "passed"1080});1081formatter.step({1082 "name": "feature out file foldertest/TestOneFeature.feature exists with:",1083 "keyword": "Given ",1084 "doc_string": {1085 "value": "Feature: Test One Feature\nGiven value is Y \n"1086 }1087});1088formatter.match({1089 "location": "StepDefinitionsMain.feature_out_exists_with(Pathname,String)"1090});1091formatter.result({1092 "status": "passed"1093});1094formatter.step({1095 "name": "delete feature output",1096 "keyword": "When "1097});1098formatter.match({1099 "location": "StepDefinitionsMain.delete_feature_output()"1100});1101formatter.result({1102 "status": "passed"1103});1104formatter.step({1105 "name": "feature out file foldertest/TestOneFeature.feature does not exist",1106 "keyword": "Then "1107});1108formatter.match({1109 "location": "StepDefinitionsMain.feature_file_foldertest_TestOneFeature_feature_does_not_exist(Pathname)"1110});1111formatter.result({1112 "status": "passed"1113});1114formatter.step({1115 "name": "feature out file TestFeature.feature does not exist",1116 "keyword": "Then "1117});1118formatter.match({1119 "location": "StepDefinitionsMain.feature_file_foldertest_TestOneFeature_feature_does_not_exist(Pathname)"1120});1121formatter.result({1122 "status": "passed"1123});1124formatter.after({1125 "status": "passed"1126});1127formatter.after({1128 "status": "passed"1129});1130formatter.after({1131 "status": "passed"1132});1133formatter.after({1134 "status": "passed"1135});1136formatter.after({1137 "status": "passed"1138});1139formatter.after({1140 "status": "passed"1141});1142formatter.after({1143 "status": "passed"1144});1145formatter.background({1146 "name": "",1147 "description": "",1148 "keyword": "Background"1149});1150formatter.before({1151 "status": "passed"1152});1153formatter.before({1154 "status": "passed"1155});1156formatter.before({1157 "status": "passed"1158});1159formatter.before({1160 "status": "passed"1161});1162formatter.before({1163 "status": "passed"1164});1165formatter.before({1166 "status": "passed"1167});1168formatter.before({1169 "status": "passed"1170});1171formatter.step({1172 "name": "delete feature output",1173 "keyword": "Given "1174});1175formatter.match({1176 "location": "StepDefinitionsMain.delete_feature_output()"1177});1178formatter.result({1179 "status": "passed"1180});1181formatter.scenario({1182 "name": "Configuration value settings",1183 "description": "",1184 "keyword": "Scenario"1185});1186formatter.step({1187 "name": "configuration values are:",1188 "rows": [1189 {1190 "cells": [1191 "Name",1192 "Value"1193 ]1194 },1195 {1196 "cells": [1197 "inputFeaturePath",1198 "featurein"1199 ]1200 },1201 {1202 "cells": [1203 "outputFeaturePath",1204 "featureout"1205 ]1206 },1207 {1208 "cells": [1209 "relativeIncludeDirectory",1210 "featurein"1211 ]1212 }1213 ],1214 "keyword": "Given "1215});1216formatter.match({1217 "location": "StepDefinitionsMain.configuration_values_are(ConfigurationValues\u003e)"1218});1219formatter.result({1220 "status": "passed"1221});1222formatter.step({1223 "name": "parameters are:",1224 "rows": [1225 {1226 "cells": [1227 "Argv"1228 ]1229 },1230 {1231 "cells": [1232 "-featurein"1233 ]1234 },1235 {1236 "cells": [1237 "xxx"1238 ]1239 },1240 {1241 "cells": [1242 "-featureout"1243 ]1244 },1245 {1246 "cells": [1247 "yyy"1248 ]1249 },1250 {1251 "cells": [1252 "-include"1253 ]1254 },1255 {1256 "cells": [1257 "zzz"1258 ]1259 }1260 ],1261 "keyword": "When "1262});1263formatter.match({1264 "location": "StepDefinitionsMain.parameters_are(ParameterInput\u003e)"1265});1266formatter.result({1267 "status": "passed"1268});1269formatter.step({1270 "name": "configuration values are:",1271 "rows": [1272 {1273 "cells": [1274 "Name",1275 "Value"1276 ]1277 },1278 {1279 "cells": [1280 "inputFeaturePath",1281 "xxx"1282 ]1283 },1284 {1285 "cells": [1286 "outputFeaturePath",1287 "yyy"1288 ]1289 },1290 {1291 "cells": [1292 "relativeIncludeDirectory",1293 "zzz"1294 ]1295 }1296 ],1297 "keyword": "Then "1298});1299formatter.match({1300 "location": "StepDefinitionsMain.configuration_values_are(ConfigurationValues\u003e)"1301});1302formatter.result({1303 "status": "passed"1304});1305formatter.after({1306 "status": "passed"1307});1308formatter.after({1309 "status": "passed"1310});1311formatter.after({1312 "status": "passed"1313});1314formatter.after({1315 "status": "passed"1316});1317formatter.after({1318 "status": "passed"1319});1320formatter.after({1321 "status": "passed"1322});1323formatter.after({1324 "status": "passed"1325});1326formatter.background({1327 "name": "",1328 "description": "",1329 "keyword": "Background"1330});1331formatter.before({1332 "status": "passed"1333});1334formatter.before({1335 "status": "passed"1336});1337formatter.before({1338 "status": "passed"1339});1340formatter.before({1341 "status": "passed"1342});1343formatter.before({1344 "status": "passed"1345});1346formatter.before({1347 "status": "passed"1348});1349formatter.before({1350 "status": "passed"1351});1352formatter.step({1353 "name": "delete feature output",1354 "keyword": "Given "1355});1356formatter.match({1357 "location": "StepDefinitionsMain.delete_feature_output()"1358});1359formatter.result({1360 "status": "passed"1361});1362formatter.scenario({1363 "name": "To execute command line settings in parser",1364 "description": "",1365 "keyword": "Scenario"1366});1367formatter.step({1368 "name": "executing program as:",1369 "keyword": "* ",1370 "doc_string": {1371 "value": "java -jar preprocessor.jar -featurein featurein -featureout featureout -include featurein "1372 }1373});1374formatter.match({1375 "location": "StepDefinitionsMain.executing_program_as(String)"1376});1377formatter.result({1378 "status": "passed"1379});1380formatter.after({1381 "status": "passed"1382});1383formatter.after({1384 "status": "passed"1385});1386formatter.after({1387 "status": "passed"1388});1389formatter.after({1390 "status": "passed"1391});1392formatter.after({1393 "status": "passed"1394});1395formatter.after({1396 "status": "passed"1397});1398formatter.after({1399 "status": "passed"1400});1401formatter.background({1402 "name": "",1403 "description": "",1404 "keyword": "Background"1405});1406formatter.before({1407 "status": "passed"1408});1409formatter.before({1410 "status": "passed"1411});1412formatter.before({1413 "status": "passed"1414});1415formatter.before({1416 "status": "passed"1417});1418formatter.before({1419 "status": "passed"1420});1421formatter.before({1422 "status": "passed"1423});1424formatter.before({1425 "status": "passed"1426});1427formatter.step({1428 "name": "delete feature output",1429 "keyword": "Given "1430});1431formatter.match({1432 "location": "StepDefinitionsMain.delete_feature_output()"1433});1434formatter.result({1435 "status": "passed"1436});1437formatter.scenario({1438 "name": "To execute command line settings in parser",1439 "description": "",1440 "keyword": "Scenario"1441});1442formatter.step({1443 "name": "executing program as:",1444 "keyword": "* ",1445 "doc_string": {1446 "value": "java -jar preprocessor.jar "1447 }1448});1449formatter.match({1450 "location": "StepDefinitionsMain.executing_program_as(String)"1451});1452formatter.result({1453 "status": "passed"1454});1455formatter.after({1456 "status": "passed"1457});1458formatter.after({1459 "status": "passed"1460});1461formatter.after({1462 "status": "passed"1463});1464formatter.after({1465 "status": "passed"1466});1467formatter.after({1468 "status": "passed"1469});1470formatter.after({1471 "status": "passed"1472});1473formatter.after({1474 "status": "passed"1475});1476formatter.uri("features/allaspects.feature");1477formatter.feature({1478 "name": "Multiple aspects combined in Preprocessor",1479 "description": "",1480 "keyword": "Feature"1481});1482formatter.background({1483 "name": "",1484 "description": "",1485 "keyword": "Background"1486});1487formatter.before({1488 "status": "passed"1489});1490formatter.before({1491 "status": "passed"1492});1493formatter.before({1494 "status": "passed"1495});1496formatter.before({1497 "status": "passed"1498});1499formatter.before({1500 "status": "passed"1501});1502formatter.before({1503 "status": "passed"1504});1505formatter.before({1506 "status": "passed"1507});1508formatter.step({1509 "name": "add local function:",1510 "rows": [1511 {1512 "cells": [1513 "Name"1514 ]1515 },1516 {1517 "cells": [1518 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"1519 ]1520 },1521 {1522 "cells": [1523 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"1524 ]1525 },1526 {1527 "cells": [1528 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"1529 ]1530 }1531 ],1532 "keyword": "When "1533});1534formatter.match({1535 "location": "StepDefinitions.add_local_function(NameInput\u003e)"1536});1537formatter.result({1538 "status": "passed"1539});1540formatter.scenario({1541 "name": "Process include with define",1542 "description": "",1543 "keyword": "Scenario"1544});1545formatter.step({1546 "name": "file SampleInclude.txt exists with:",1547 "keyword": "Given ",1548 "doc_string": {1549 "value": "#define X 14\n"1550 }1551});1552formatter.match({1553 "location": "StepDefinitions.file_exists_with(Pathname,String)"1554});1555formatter.result({1556 "status": "passed"1557});1558formatter.step({1559 "name": "processing:",1560 "keyword": "When ",1561 "doc_string": {1562 "value": "First line\n#include \"SampleInclude.txt\"\nValue is X \nLast line"1563 }1564});1565formatter.match({1566 "location": "StepDefinitions.processing(String)"1567});1568formatter.result({1569 "status": "passed"1570});1571formatter.step({1572 "name": "result is:",1573 "keyword": "Then ",1574 "doc_string": {1575 "value": "First line\nValue is 14 \nLast line"1576 }1577});1578formatter.match({1579 "location": "StepDefinitions.result_is(String)"1580});1581formatter.result({1582 "status": "passed"1583});1584formatter.after({1585 "status": "passed"1586});1587formatter.after({1588 "status": "passed"1589});1590formatter.after({1591 "status": "passed"1592});1593formatter.after({1594 "status": "passed"1595});1596formatter.after({1597 "status": "passed"1598});1599formatter.after({1600 "status": "passed"1601});1602formatter.after({1603 "status": "passed"1604});1605formatter.background({1606 "name": "",1607 "description": "",1608 "keyword": "Background"1609});1610formatter.before({1611 "status": "passed"1612});1613formatter.before({1614 "status": "passed"1615});1616formatter.before({1617 "status": "passed"1618});1619formatter.before({1620 "status": "passed"1621});1622formatter.before({1623 "status": "passed"1624});1625formatter.before({1626 "status": "passed"1627});1628formatter.before({1629 "status": "passed"1630});1631formatter.step({1632 "name": "add local function:",1633 "rows": [1634 {1635 "cells": [1636 "Name"1637 ]1638 },1639 {1640 "cells": [1641 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"1642 ]1643 },1644 {1645 "cells": [1646 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"1647 ]1648 },1649 {1650 "cells": [1651 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"1652 ]1653 }1654 ],1655 "keyword": "When "1656});1657formatter.match({1658 "location": "StepDefinitions.add_local_function(NameInput\u003e)"1659});1660formatter.result({1661 "status": "passed"1662});1663formatter.scenario({1664 "name": "Process define in an expression",1665 "description": "",1666 "keyword": "Scenario"1667});1668formatter.step({1669 "name": "defines set up:",1670 "rows": [1671 {1672 "cells": [1673 "Define",1674 "Value"1675 ]1676 },1677 {1678 "cells": [1679 "Y",1680 "15"1681 ]1682 },1683 {1684 "cells": [1685 "X",1686 "\u003d Y + 3"1687 ]1688 }1689 ],1690 "keyword": "Given "1691});1692formatter.match({1693 "location": "StepDefinitions.defines_set_up(DefineValues\u003e)"1694});1695formatter.result({1696 "status": "passed"1697});1698formatter.step({1699 "name": "processing defines",1700 "keyword": "When "1701});1702formatter.match({1703 "location": "StepDefinitions.processing_defines()"1704});1705formatter.result({1706 "status": "passed"1707});1708formatter.step({1709 "name": "defines are:",1710 "rows": [1711 {1712 "cells": [1713 "Define",1714 "Value"1715 ]1716 },1717 {1718 "cells": [1719 "Y",1720 "15"1721 ]1722 },1723 {1724 "cells": [1725 "X",1726 "18"1727 ]1728 }1729 ],1730 "keyword": "Then "1731});1732formatter.match({1733 "location": "StepDefinitions.defines_are(DefineValues\u003e)"1734});1735formatter.result({1736 "status": "passed"1737});1738formatter.after({1739 "status": "passed"1740});1741formatter.after({1742 "status": "passed"1743});1744formatter.after({1745 "status": "passed"1746});1747formatter.after({1748 "status": "passed"1749});1750formatter.after({1751 "status": "passed"1752});1753formatter.after({1754 "status": "passed"1755});1756formatter.after({1757 "status": "passed"1758});1759formatter.background({1760 "name": "",1761 "description": "",1762 "keyword": "Background"1763});1764formatter.before({1765 "status": "passed"1766});1767formatter.before({1768 "status": "passed"1769});1770formatter.before({1771 "status": "passed"1772});1773formatter.before({1774 "status": "passed"1775});1776formatter.before({1777 "status": "passed"1778});1779formatter.before({1780 "status": "passed"1781});1782formatter.before({1783 "status": "passed"1784});1785formatter.step({1786 "name": "add local function:",1787 "rows": [1788 {1789 "cells": [1790 "Name"1791 ]1792 },1793 {1794 "cells": [1795 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"1796 ]1797 },1798 {1799 "cells": [1800 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"1801 ]1802 },1803 {1804 "cells": [1805 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"1806 ]1807 }1808 ],1809 "keyword": "When "1810});1811formatter.match({1812 "location": "StepDefinitions.add_local_function(NameInput\u003e)"1813});1814formatter.result({1815 "status": "passed"1816});1817formatter.scenario({1818 "name": "Process bad expression",1819 "description": "",1820 "keyword": "Scenario"1821});1822formatter.step({1823 "name": "defines set up:",1824 "rows": [1825 {1826 "cells": [1827 "Define",1828 "Value"1829 ]1830 },1831 {1832 "cells": [1833 "Y",1834 "q17"1835 ]1836 },1837 {1838 "cells": [1839 "X",1840 "\u003d Y + 3"1841 ]1842 }1843 ],1844 "keyword": "Given "1845});1846formatter.match({1847 "location": "StepDefinitions.defines_set_up(DefineValues\u003e)"1848});1849formatter.result({1850 "status": "passed"1851});1852formatter.step({1853 "name": "processing defines",1854 "keyword": "When "1855});1856formatter.match({1857 "location": "StepDefinitions.processing_defines()"1858});1859formatter.result({1860 "status": "passed"1861});1862formatter.step({1863 "name": "defines are:",1864 "rows": [1865 {1866 "cells": [1867 "Define",1868 "Value"1869 ]1870 },1871 {1872 "cells": [1873 "Y",1874 "q17"1875 ]1876 },1877 {1878 "cells": [1879 "X",1880 "q17 + 3"1881 ]1882 }1883 ],1884 "keyword": "Then "1885});1886formatter.match({1887 "location": "StepDefinitions.defines_are(DefineValues\u003e)"1888});1889formatter.result({1890 "status": "passed"1891});1892formatter.after({1893 "status": "passed"1894});1895formatter.after({1896 "status": "passed"1897});1898formatter.after({1899 "status": "passed"1900});1901formatter.after({1902 "status": "passed"1903});1904formatter.after({1905 "status": "passed"1906});1907formatter.after({1908 "status": "passed"1909});1910formatter.after({1911 "status": "passed"1912});1913formatter.background({1914 "name": "",1915 "description": "",1916 "keyword": "Background"1917});1918formatter.before({1919 "status": "passed"1920});1921formatter.before({1922 "status": "passed"1923});1924formatter.before({1925 "status": "passed"1926});1927formatter.before({1928 "status": "passed"1929});1930formatter.before({1931 "status": "passed"1932});1933formatter.before({1934 "status": "passed"1935});1936formatter.before({1937 "status": "passed"1938});1939formatter.step({1940 "name": "add local function:",1941 "rows": [1942 {1943 "cells": [1944 "Name"1945 ]1946 },1947 {1948 "cells": [1949 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"1950 ]1951 },1952 {1953 "cells": [1954 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"1955 ]1956 },1957 {1958 "cells": [1959 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"1960 ]1961 }1962 ],1963 "keyword": "When "1964});1965formatter.match({1966 "location": "StepDefinitions.add_local_function(NameInput\u003e)"1967});1968formatter.result({1969 "status": "passed"1970});1971formatter.scenario({1972 "name": "Process an internal function in expression",1973 "description": "",1974 "keyword": "Scenario"1975});1976formatter.step({1977 "name": "defines set up:",1978 "rows": [1979 {1980 "cells": [1981 "Define",1982 "Value"1983 ]1984 },1985 {1986 "cells": [1987 "X",1988 "\u003d TestFunctionReturnsAAA()"1989 ]1990 },1991 {1992 "cells": [1993 "Y",1994 "\u003d TestFunctionReturnsAAA(a)"1995 ]1996 },1997 {1998 "cells": [1999 "Z",2000 "\u003d TestFunctionReturnsAAA(a,b)"2001 ]2002 }2003 ],2004 "keyword": "Given "2005});2006formatter.match({2007 "location": "StepDefinitions.defines_set_up(DefineValues\u003e)"2008});2009formatter.result({2010 "status": "passed"2011});2012formatter.step({2013 "name": "processing defines",2014 "keyword": "When "2015});2016formatter.match({2017 "location": "StepDefinitions.processing_defines()"2018});2019formatter.result({2020 "status": "passed"2021});2022formatter.step({2023 "name": "defines are:",2024 "rows": [2025 {2026 "cells": [2027 "Define",2028 "Value"2029 ]2030 },2031 {2032 "cells": [2033 "X",2034 "AAA"2035 ]2036 },2037 {2038 "cells": [2039 "Y",2040 "AAAa"2041 ]2042 },2043 {2044 "cells": [2045 "Z",2046 "AAAab"2047 ]2048 }2049 ],2050 "keyword": "Then "2051});2052formatter.match({2053 "location": "StepDefinitions.defines_are(DefineValues\u003e)"2054});2055formatter.result({2056 "status": "passed"2057});2058formatter.after({2059 "status": "passed"2060});2061formatter.after({2062 "status": "passed"2063});2064formatter.after({2065 "status": "passed"2066});2067formatter.after({2068 "status": "passed"2069});2070formatter.after({2071 "status": "passed"2072});2073formatter.after({2074 "status": "passed"2075});2076formatter.after({2077 "status": "passed"2078});2079formatter.background({2080 "name": "",2081 "description": "",2082 "keyword": "Background"2083});2084formatter.before({2085 "status": "passed"2086});2087formatter.before({2088 "status": "passed"2089});2090formatter.before({2091 "status": "passed"2092});2093formatter.before({2094 "status": "passed"2095});2096formatter.before({2097 "status": "passed"2098});2099formatter.before({2100 "status": "passed"2101});2102formatter.before({2103 "status": "passed"2104});2105formatter.step({2106 "name": "add local function:",2107 "rows": [2108 {2109 "cells": [2110 "Name"2111 ]2112 },2113 {2114 "cells": [2115 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"2116 ]2117 },2118 {2119 "cells": [2120 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"2121 ]2122 },2123 {2124 "cells": [2125 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"2126 ]2127 }2128 ],2129 "keyword": "When "2130});2131formatter.match({2132 "location": "StepDefinitions.add_local_function(NameInput\u003e)"2133});2134formatter.result({2135 "status": "passed"2136});2137formatter.scenario({2138 "name": "Process define within function parameter",2139 "description": "",2140 "keyword": "Scenario"2141});2142formatter.step({2143 "name": "defines set up:",2144 "rows": [2145 {2146 "cells": [2147 "Define",2148 "Value"2149 ]2150 },2151 {2152 "cells": [2153 "X",2154 "Something to append"2155 ]2156 },2157 {2158 "cells": [2159 "Y",2160 "\u003d TestFunctionReturnsAAA(X)"2161 ]2162 }2163 ],2164 "keyword": "Given "2165});2166formatter.match({2167 "location": "StepDefinitions.defines_set_up(DefineValues\u003e)"2168});2169formatter.result({2170 "status": "passed"2171});2172formatter.step({2173 "name": "processing defines",2174 "keyword": "When "2175});2176formatter.match({2177 "location": "StepDefinitions.processing_defines()"2178});2179formatter.result({2180 "status": "passed"2181});2182formatter.step({2183 "name": "defines are:",2184 "rows": [2185 {2186 "cells": [2187 "Define",2188 "Value"2189 ]2190 },2191 {2192 "cells": [2193 "X",2194 "Something to append"2195 ]2196 },2197 {2198 "cells": [2199 "Y",2200 "AAASomething to append"2201 ]2202 }2203 ],2204 "keyword": "Then "2205});2206formatter.match({2207 "location": "StepDefinitions.defines_are(DefineValues\u003e)"2208});2209formatter.result({2210 "status": "passed"2211});2212formatter.after({2213 "status": "passed"2214});2215formatter.after({2216 "status": "passed"2217});2218formatter.after({2219 "status": "passed"2220});2221formatter.after({2222 "status": "passed"2223});2224formatter.after({2225 "status": "passed"2226});2227formatter.after({2228 "status": "passed"2229});2230formatter.after({2231 "status": "passed"2232});2233formatter.background({2234 "name": "",2235 "description": "",2236 "keyword": "Background"2237});2238formatter.before({2239 "status": "passed"2240});2241formatter.before({2242 "status": "passed"2243});2244formatter.before({2245 "status": "passed"2246});2247formatter.before({2248 "status": "passed"2249});2250formatter.before({2251 "status": "passed"2252});2253formatter.before({2254 "status": "passed"2255});2256formatter.before({2257 "status": "passed"2258});2259formatter.step({2260 "name": "add local function:",2261 "rows": [2262 {2263 "cells": [2264 "Name"2265 ]2266 },2267 {2268 "cells": [2269 "com.atddbdd.preprocessor.tests.TestFunctionReturnsZ"2270 ]2271 },2272 {2273 "cells": [2274 "com.atddbdd.preprocessor.tests.TestFunctionReturnsAAA"2275 ]2276 },2277 {2278 "cells": [2279 "com.atddbdd.preprocessor.tests.TestFunctionReturnsWhatIsPassed"2280 ]2281 }2282 ],2283 "keyword": "When "2284});2285formatter.match({2286 "location": "StepDefinitions.add_local_function(NameInput\u003e)"2287});2288formatter.result({2289 "status": "passed"2290});2291formatter.scenario({2292 "name": "Process a function parameter in an expression",2293 "description": "",2294 "keyword": "Scenario"2295});2296formatter.step({2297 "name": "defines set up:",2298 "rows": [2299 {2300 "cells": [2301 "Define",2302 "Value"2303 ]2304 },2305 {2306 "cells": [2307 "Y",2308 "\u003d TestFunctionReturnsWhatIsPassed(11) + 3"2309 ]2310 }2311 ],2312 "keyword": "Given "2313});2314formatter.match({2315 "location": "StepDefinitions.defines_set_up(DefineValues\u003e)"2316});2317formatter.result({2318 "status": "passed"2319});2320formatter.step({2321 "name": "processing defines",2322 "keyword": "When "...
Vector3.js
Source:Vector3.js
1/**2 * @author bhouston / http://exocortex.com3 */4module( "Vector3" );5test( "constructor", function() {6 var a = new THREE.Vector3();7 ok( a.x == 0, "Passed!" );8 ok( a.y == 0, "Passed!" );9 ok( a.z == 0, "Passed!" );10 a = new THREE.Vector3( x, y, z );11 ok( a.x === x, "Passed!" );12 ok( a.y === y, "Passed!" );13 ok( a.z === z, "Passed!" );14});15test( "copy", function() {16 var a = new THREE.Vector3( x, y, z );17 var b = new THREE.Vector3().copy( a );18 ok( b.x == x, "Passed!" );19 ok( b.y == y, "Passed!" );20 ok( b.z == z, "Passed!" );21 // ensure that it is a true copy22 a.x = 0;23 a.y = -1;24 a.z = -2;25 ok( b.x == x, "Passed!" );26 ok( b.y == y, "Passed!" );27 ok( b.z == z, "Passed!" );28});29test( "set", function() {30 var a = new THREE.Vector3();31 ok( a.x == 0, "Passed!" );32 ok( a.y == 0, "Passed!" );33 ok( a.z == 0, "Passed!" );34 a.set( x, y, z );35 ok( a.x == x, "Passed!" );36 ok( a.y == y, "Passed!" );37 ok( a.z == z, "Passed!" );38});39test( "setX,setY,setZ", function() {40 var a = new THREE.Vector3();41 ok( a.x == 0, "Passed!" );42 ok( a.y == 0, "Passed!" );43 ok( a.z == 0, "Passed!" );44 a.setX( x );45 a.setY( y );46 a.setZ( z );47 ok( a.x == x, "Passed!" );48 ok( a.y == y, "Passed!" );49 ok( a.z == z, "Passed!" );50});51test( "setComponent,getComponent", function() {52 var a = new THREE.Vector3();53 ok( a.x == 0, "Passed!" );54 ok( a.y == 0, "Passed!" );55 ok( a.z == 0, "Passed!" );56 a.setComponent( 0, 1 );57 a.setComponent( 1, 2 );58 a.setComponent( 2, 3 );59 ok( a.getComponent( 0 ) == 1, "Passed!" );60 ok( a.getComponent( 1 ) == 2, "Passed!" );61 ok( a.getComponent( 2 ) == 3, "Passed!" );62});63test( "add", function() {64 var a = new THREE.Vector3( x, y, z );65 var b = new THREE.Vector3( -x, -y, -z );66 a.add( b );67 ok( a.x == 0, "Passed!" );68 ok( a.y == 0, "Passed!" );69 ok( a.z == 0, "Passed!" );70 var c = new THREE.Vector3().addVectors( b, b );71 ok( c.x == -2*x, "Passed!" );72 ok( c.y == -2*y, "Passed!" );73 ok( c.z == -2*z, "Passed!" );74});75test( "sub", function() {76 var a = new THREE.Vector3( x, y, z );77 var b = new THREE.Vector3( -x, -y, -z );78 a.sub( b );79 ok( a.x == 2*x, "Passed!" );80 ok( a.y == 2*y, "Passed!" );81 ok( a.z == 2*z, "Passed!" );82 var c = new THREE.Vector3().subVectors( a, a );83 ok( c.x == 0, "Passed!" );84 ok( c.y == 0, "Passed!" );85 ok( c.z == 0, "Passed!" );86});87test( "multiply/divide", function() {88 var a = new THREE.Vector3( x, y, z );89 var b = new THREE.Vector3( -x, -y, -z );90 a.multiplyScalar( -2 );91 ok( a.x == x*-2, "Passed!" );92 ok( a.y == y*-2, "Passed!" );93 ok( a.z == z*-2, "Passed!" );94 b.multiplyScalar( -2 );95 ok( b.x == 2*x, "Passed!" );96 ok( b.y == 2*y, "Passed!" );97 ok( b.z == 2*z, "Passed!" );98 a.divideScalar( -2 );99 ok( a.x == x, "Passed!" );100 ok( a.y == y, "Passed!" );101 ok( a.z == z, "Passed!" );102 b.divideScalar( -2 );103 ok( b.x == -x, "Passed!" );104 ok( b.y == -y, "Passed!" );105 ok( b.z == -z, "Passed!" );106});107test( "min/max/clamp", function() {108 var a = new THREE.Vector3( x, y, z );109 var b = new THREE.Vector3( -x, -y, -z );110 var c = new THREE.Vector3();111 c.copy( a ).min( b );112 ok( c.x == -x, "Passed!" );113 ok( c.y == -y, "Passed!" );114 ok( c.z == -z, "Passed!" );115 c.copy( a ).max( b );116 ok( c.x == x, "Passed!" );117 ok( c.y == y, "Passed!" );118 ok( c.z == z, "Passed!" );119 c.set( -2*x, 2*y, -2*z );120 c.clamp( b, a );121 ok( c.x == -x, "Passed!" );122 ok( c.y == y, "Passed!" );123 ok( c.z == -z, "Passed!" );124});125test( "negate", function() {126 var a = new THREE.Vector3( x, y, z );127 a.negate();128 ok( a.x == -x, "Passed!" );129 ok( a.y == -y, "Passed!" );130 ok( a.z == -z, "Passed!" );131});132test( "dot", function() {133 var a = new THREE.Vector3( x, y, z );134 var b = new THREE.Vector3( -x, -y, -z );135 var c = new THREE.Vector3();136 var result = a.dot( b );137 ok( result == (-x*x-y*y-z*z), "Passed!" );138 result = a.dot( c );139 ok( result == 0, "Passed!" );140});141test( "length/lengthSq", function() {142 var a = new THREE.Vector3( x, 0, 0 );143 var b = new THREE.Vector3( 0, -y, 0 );144 var c = new THREE.Vector3( 0, 0, z );145 var d = new THREE.Vector3();146 ok( a.length() == x, "Passed!" );147 ok( a.lengthSq() == x*x, "Passed!" );148 ok( b.length() == y, "Passed!" );149 ok( b.lengthSq() == y*y, "Passed!" );150 ok( c.length() == z, "Passed!" );151 ok( c.lengthSq() == z*z, "Passed!" );152 ok( d.length() == 0, "Passed!" );153 ok( d.lengthSq() == 0, "Passed!" );154 a.set( x, y, z );155 ok( a.length() == Math.sqrt( x*x + y*y + z*z ), "Passed!" );156 ok( a.lengthSq() == ( x*x + y*y + z*z ), "Passed!" );157});158test( "normalize", function() {159 var a = new THREE.Vector3( x, 0, 0 );160 var b = new THREE.Vector3( 0, -y, 0 );161 var c = new THREE.Vector3( 0, 0, z );162 a.normalize();163 ok( a.length() == 1, "Passed!" );164 ok( a.x == 1, "Passed!" );165 b.normalize();166 ok( b.length() == 1, "Passed!" );167 ok( b.y == -1, "Passed!" );168 c.normalize();169 ok( c.length() == 1, "Passed!" );170 ok( c.z == 1, "Passed!" );171});172test( "distanceTo/distanceToSquared", function() {173 var a = new THREE.Vector3( x, 0, 0 );174 var b = new THREE.Vector3( 0, -y, 0 );175 var c = new THREE.Vector3( 0, 0, z );176 var d = new THREE.Vector3();177 ok( a.distanceTo( d ) == x, "Passed!" );178 ok( a.distanceToSquared( d ) == x*x, "Passed!" );179 ok( b.distanceTo( d ) == y, "Passed!" );180 ok( b.distanceToSquared( d ) == y*y, "Passed!" );181 ok( c.distanceTo( d ) == z, "Passed!" );182 ok( c.distanceToSquared( d ) == z*z, "Passed!" );183});184test( "setLength", function() {185 var a = new THREE.Vector3( x, 0, 0 );186 ok( a.length() == x, "Passed!" );187 a.setLength( y );188 ok( a.length() == y, "Passed!" );189 a = new THREE.Vector3( 0, 0, 0 );190 ok( a.length() == 0, "Passed!" );191 a.setLength( y );192 ok( a.length() == 0, "Passed!" );193});194test( "projectOnVector", function() {195 var a = new THREE.Vector3( 1, 0, 0 );196 var b = new THREE.Vector3();197 var normal = new THREE.Vector3( 10, 0, 0 );198 ok( b.copy( a ).projectOnVector( normal ).equals( new THREE.Vector3( 1, 0, 0 ) ), "Passed!" );199 a.set( 0, 1, 0 );200 ok( b.copy( a ).projectOnVector( normal ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );201 a.set( 0, 0, -1 );202 ok( b.copy( a ).projectOnVector( normal ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );203 a.set( -1, 0, 0 );204 ok( b.copy( a ).projectOnVector( normal ).equals( new THREE.Vector3( -1, 0, 0 ) ), "Passed!" );205});206test( "projectOnPlane", function() {207 var a = new THREE.Vector3( 1, 0, 0 );208 var b = new THREE.Vector3();209 var normal = new THREE.Vector3( 1, 0, 0 );210 ok( b.copy( a ).projectOnPlane( normal ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );211 a.set( 0, 1, 0 );212 ok( b.copy( a ).projectOnPlane( normal ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );213 a.set( 0, 0, -1 );214 ok( b.copy( a ).projectOnPlane( normal ).equals( new THREE.Vector3( 0, 0, -1 ) ), "Passed!" );215 a.set( -1, 0, 0 );216 ok( b.copy( a ).projectOnPlane( normal ).equals( new THREE.Vector3( 0, 0, 0 ) ), "Passed!" );217});218test( "reflect", function() {219 var a = new THREE.Vector3();220 var normal = new THREE.Vector3( 0, 1, 0 );221 var b = new THREE.Vector3();222 a.set( 0, -1, 0 );223 ok( b.copy( a ).reflect( normal ).equals( new THREE.Vector3( 0, 1, 0 ) ), "Passed!" );224 a.set( 1, -1, 0 );225 ok( b.copy( a ).reflect( normal ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" );226 a.set( 1, -1, 0 );227 normal.set( 0, -1, 0 );228 ok( b.copy( a ).reflect( normal ).equals( new THREE.Vector3( 1, 1, 0 ) ), "Passed!" );229});230test( "angleTo", function() {231 var a = new THREE.Vector3( 0, -0.18851655680720186, 0.9820700116639124 );232 var b = new THREE.Vector3( 0, 0.18851655680720186, -0.9820700116639124 );233 equal( a.angleTo( a ), 0 );234 equal( a.angleTo( b ), Math.PI );235 var x = new THREE.Vector3( 1, 0, 0 );236 var y = new THREE.Vector3( 0, 1, 0 );237 var z = new THREE.Vector3( 0, 0, 1 );238 equal( x.angleTo( y ), Math.PI / 2 );239 equal( x.angleTo( z ), Math.PI / 2 );240 equal( z.angleTo( x ), Math.PI / 2 );241 ok( Math.abs( x.angleTo( new THREE.Vector3( 1, 1, 0 ) ) - ( Math.PI / 4 ) ) < 0.0000001 );242});243test( "lerp/clone", function() {244 var a = new THREE.Vector3( x, 0, z );245 var b = new THREE.Vector3( 0, -y, 0 );246 ok( a.lerp( a, 0 ).equals( a.lerp( a, 0.5 ) ), "Passed!" );247 ok( a.lerp( a, 0 ).equals( a.lerp( a, 1 ) ), "Passed!" );248 ok( a.clone().lerp( b, 0 ).equals( a ), "Passed!" );249 ok( a.clone().lerp( b, 0.5 ).x == x*0.5, "Passed!" );250 ok( a.clone().lerp( b, 0.5 ).y == -y*0.5, "Passed!" );251 ok( a.clone().lerp( b, 0.5 ).z == z*0.5, "Passed!" );252 ok( a.clone().lerp( b, 1 ).equals( b ), "Passed!" );253});254test( "equals", function() {255 var a = new THREE.Vector3( x, 0, z );256 var b = new THREE.Vector3( 0, -y, 0 );257 ok( a.x != b.x, "Passed!" );258 ok( a.y != b.y, "Passed!" );259 ok( a.z != b.z, "Passed!" );260 ok( ! a.equals( b ), "Passed!" );261 ok( ! b.equals( a ), "Passed!" );262 a.copy( b );263 ok( a.x == b.x, "Passed!" );264 ok( a.y == b.y, "Passed!" );265 ok( a.z == b.z, "Passed!" );266 ok( a.equals( b ), "Passed!" );267 ok( b.equals( a ), "Passed!" );...
Vector4.js
Source:Vector4.js
1/**2 * @author bhouston / http://exocortex.com3 */4module( "Vector4" );5test( "constructor", function() {6 var a = new THREE.Vector4();7 ok( a.x == 0, "Passed!" );8 ok( a.y == 0, "Passed!" );9 ok( a.z == 0, "Passed!" );10 ok( a.w == 1, "Passed!" );11 a = new THREE.Vector4( x, y, z, w );12 ok( a.x === x, "Passed!" );13 ok( a.y === y, "Passed!" );14 ok( a.z === z, "Passed!" );15 ok( a.w === w, "Passed!" );16});17test( "copy", function() {18 var a = new THREE.Vector4( x, y, z, w );19 var b = new THREE.Vector4().copy( a );20 ok( b.x == x, "Passed!" );21 ok( b.y == y, "Passed!" );22 ok( b.z == z, "Passed!" );23 ok( b.w == w, "Passed!" );24 // ensure that it is a true copy25 a.x = 0;26 a.y = -1;27 a.z = -2;28 a.w = -3;29 ok( b.x == x, "Passed!" );30 ok( b.y == y, "Passed!" );31 ok( b.z == z, "Passed!" );32 ok( b.w == w, "Passed!" );33});34test( "set", function() {35 var a = new THREE.Vector4();36 ok( a.x == 0, "Passed!" );37 ok( a.y == 0, "Passed!" );38 ok( a.z == 0, "Passed!" );39 ok( a.w == 1, "Passed!" );40 a.set( x, y, z, w );41 ok( a.x == x, "Passed!" );42 ok( a.y == y, "Passed!" );43 ok( a.z == z, "Passed!" );44 ok( a.w == w, "Passed!" );45});46test( "setX,setY,setZ,setW", function() {47 var a = new THREE.Vector4();48 ok( a.x == 0, "Passed!" );49 ok( a.y == 0, "Passed!" );50 ok( a.z == 0, "Passed!" );51 ok( a.w == 1, "Passed!" );52 a.setX( x );53 a.setY( y );54 a.setZ( z );55 a.setW( w );56 ok( a.x == x, "Passed!" );57 ok( a.y == y, "Passed!" );58 ok( a.z == z, "Passed!" );59 ok( a.w == w, "Passed!" );60});61test( "setComponent,getComponent", function() {62 var a = new THREE.Vector4();63 ok( a.x == 0, "Passed!" );64 ok( a.y == 0, "Passed!" );65 ok( a.z == 0, "Passed!" );66 ok( a.w == 1, "Passed!" );67 a.setComponent( 0, 1 );68 a.setComponent( 1, 2 );69 a.setComponent( 2, 3 );70 a.setComponent( 3, 4 );71 ok( a.getComponent( 0 ) == 1, "Passed!" );72 ok( a.getComponent( 1 ) == 2, "Passed!" );73 ok( a.getComponent( 2 ) == 3, "Passed!" );74 ok( a.getComponent( 3 ) == 4, "Passed!" );75});76test( "add", function() {77 var a = new THREE.Vector4( x, y, z, w );78 var b = new THREE.Vector4( -x, -y, -z, -w );79 a.add( b );80 ok( a.x == 0, "Passed!" );81 ok( a.y == 0, "Passed!" );82 ok( a.z == 0, "Passed!" );83 ok( a.w == 0, "Passed!" );84 var c = new THREE.Vector4().addVectors( b, b );85 ok( c.x == -2*x, "Passed!" );86 ok( c.y == -2*y, "Passed!" );87 ok( c.z == -2*z, "Passed!" );88 ok( c.w == -2*w, "Passed!" );89});90test( "sub", function() {91 var a = new THREE.Vector4( x, y, z, w );92 var b = new THREE.Vector4( -x, -y, -z, -w );93 a.sub( b );94 ok( a.x == 2*x, "Passed!" );95 ok( a.y == 2*y, "Passed!" );96 ok( a.z == 2*z, "Passed!" );97 ok( a.w == 2*w, "Passed!" );98 var c = new THREE.Vector4().subVectors( a, a );99 ok( c.x == 0, "Passed!" );100 ok( c.y == 0, "Passed!" );101 ok( c.z == 0, "Passed!" );102 ok( c.w == 0, "Passed!" );103});104test( "multiply/divide", function() {105 var a = new THREE.Vector4( x, y, z, w );106 var b = new THREE.Vector4( -x, -y, -z, -w );107 a.multiplyScalar( -2 );108 ok( a.x == x*-2, "Passed!" );109 ok( a.y == y*-2, "Passed!" );110 ok( a.z == z*-2, "Passed!" );111 ok( a.w == w*-2, "Passed!" );112 b.multiplyScalar( -2 );113 ok( b.x == 2*x, "Passed!" );114 ok( b.y == 2*y, "Passed!" ); 115 ok( b.z == 2*z, "Passed!" ); 116 ok( b.w == 2*w, "Passed!" ); 117 a.divideScalar( -2 );118 ok( a.x == x, "Passed!" );119 ok( a.y == y, "Passed!" );120 ok( a.z == z, "Passed!" );121 ok( a.w == w, "Passed!" );122 b.divideScalar( -2 );123 ok( b.x == -x, "Passed!" );124 ok( b.y == -y, "Passed!" );125 ok( b.z == -z, "Passed!" );126 ok( b.w == -w, "Passed!" );127});128test( "min/max/clamp", function() {129 var a = new THREE.Vector4( x, y, z, w );130 var b = new THREE.Vector4( -x, -y, -z, -w );131 var c = new THREE.Vector4();132 c.copy( a ).min( b );133 ok( c.x == -x, "Passed!" );134 ok( c.y == -y, "Passed!" );135 ok( c.z == -z, "Passed!" );136 ok( c.w == -w, "Passed!" );137 c.copy( a ).max( b );138 ok( c.x == x, "Passed!" );139 ok( c.y == y, "Passed!" );140 ok( c.z == z, "Passed!" );141 ok( c.w == w, "Passed!" );142 c.set( -2*x, 2*y, -2*z, 2*w );143 c.clamp( b, a );144 ok( c.x == -x, "Passed!" );145 ok( c.y == y, "Passed!" );146 ok( c.z == -z, "Passed!" );147 ok( c.w == w, "Passed!" );148});149test( "negate", function() {150 var a = new THREE.Vector4( x, y, z, w );151 a.negate();152 ok( a.x == -x, "Passed!" );153 ok( a.y == -y, "Passed!" );154 ok( a.z == -z, "Passed!" );155 ok( a.w == -w, "Passed!" );156});157test( "dot", function() {158 var a = new THREE.Vector4( x, y, z, w );159 var b = new THREE.Vector4( -x, -y, -z, -w );160 var c = new THREE.Vector4( 0, 0, 0, 0 );161 var result = a.dot( b );162 ok( result == (-x*x-y*y-z*z-w*w), "Passed!" );163 result = a.dot( c );164 ok( result == 0, "Passed!" );165});166test( "length/lengthSq", function() {167 var a = new THREE.Vector4( x, 0, 0, 0 );168 var b = new THREE.Vector4( 0, -y, 0, 0 );169 var c = new THREE.Vector4( 0, 0, z, 0 );170 var d = new THREE.Vector4( 0, 0, 0, w );171 var e = new THREE.Vector4( 0, 0, 0, 0 );172 173 ok( a.length() == x, "Passed!" );174 ok( a.lengthSq() == x*x, "Passed!" );175 ok( b.length() == y, "Passed!" );176 ok( b.lengthSq() == y*y, "Passed!" );177 ok( c.length() == z, "Passed!" );178 ok( c.lengthSq() == z*z, "Passed!" );179 ok( d.length() == w, "Passed!" );180 ok( d.lengthSq() == w*w, "Passed!" );181 ok( e.length() == 0, "Passed!" );182 ok( e.lengthSq() == 0, "Passed!" );183 a.set( x, y, z, w );184 ok( a.length() == Math.sqrt( x*x + y*y + z*z + w*w ), "Passed!" );185 ok( a.lengthSq() == ( x*x + y*y + z*z + w*w ), "Passed!" );186});187test( "normalize", function() {188 var a = new THREE.Vector4( x, 0, 0, 0 );189 var b = new THREE.Vector4( 0, -y, 0, 0 );190 var c = new THREE.Vector4( 0, 0, z, 0 );191 var d = new THREE.Vector4( 0, 0, 0, -w );192 193 a.normalize();194 ok( a.length() == 1, "Passed!" );195 ok( a.x == 1, "Passed!" );196 b.normalize();197 ok( b.length() == 1, "Passed!" );198 ok( b.y == -1, "Passed!" );199 c.normalize();200 ok( c.length() == 1, "Passed!" );201 ok( c.z == 1, "Passed!" );202 d.normalize();203 ok( d.length() == 1, "Passed!" );204 ok( d.w == -1, "Passed!" );205});206/*207test( "distanceTo/distanceToSquared", function() {208 var a = new THREE.Vector4( x, 0, 0, 0 );209 var b = new THREE.Vector4( 0, -y, 0, 0 );210 var c = new THREE.Vector4( 0, 0, z, 0 );211 var d = new THREE.Vector4( 0, 0, 0, -w );212 var e = new THREE.Vector4();213 214 ok( a.distanceTo( e ) == x, "Passed!" );215 ok( a.distanceToSquared( e ) == x*x, "Passed!" );216 ok( b.distanceTo( e ) == y, "Passed!" );217 ok( b.distanceToSquared( e ) == y*y, "Passed!" );218 ok( c.distanceTo( e ) == z, "Passed!" );219 ok( c.distanceToSquared( e ) == z*z, "Passed!" );220 ok( d.distanceTo( e ) == w, "Passed!" );221 ok( d.distanceToSquared( e ) == w*w, "Passed!" );222});223*/224test( "setLength", function() {225 var a = new THREE.Vector4( x, 0, 0, 0 );226 ok( a.length() == x, "Passed!" );227 a.setLength( y );228 ok( a.length() == y, "Passed!" );229 a = new THREE.Vector4( 0, 0, 0, 0 );230 ok( a.length() == 0, "Passed!" );231 a.setLength( y );232 ok( a.length() == 0, "Passed!" );233});234test( "lerp/clone", function() {235 var a = new THREE.Vector4( x, 0, z, 0 );236 var b = new THREE.Vector4( 0, -y, 0, -w );237 ok( a.lerp( a, 0 ).equals( a.lerp( a, 0.5 ) ), "Passed!" );238 ok( a.lerp( a, 0 ).equals( a.lerp( a, 1 ) ), "Passed!" );239 ok( a.clone().lerp( b, 0 ).equals( a ), "Passed!" );240 ok( a.clone().lerp( b, 0.5 ).x == x*0.5, "Passed!" );241 ok( a.clone().lerp( b, 0.5 ).y == -y*0.5, "Passed!" );242 ok( a.clone().lerp( b, 0.5 ).z == z*0.5, "Passed!" );243 ok( a.clone().lerp( b, 0.5 ).w == -w*0.5, "Passed!" );244 ok( a.clone().lerp( b, 1 ).equals( b ), "Passed!" );245});246test( "equals", function() {247 var a = new THREE.Vector4( x, 0, z, 0 );248 var b = new THREE.Vector4( 0, -y, 0, -w );249 ok( a.x != b.x, "Passed!" );250 ok( a.y != b.y, "Passed!" );251 ok( a.z != b.z, "Passed!" );252 ok( a.w != b.w, "Passed!" );253 ok( ! a.equals( b ), "Passed!" );254 ok( ! b.equals( a ), "Passed!" );255 a.copy( b );256 ok( a.x == b.x, "Passed!" );257 ok( a.y == b.y, "Passed!" );258 ok( a.z == b.z, "Passed!" );259 ok( a.w == b.w, "Passed!" );260 ok( a.equals( b ), "Passed!" );261 ok( b.equals( a ), "Passed!" );...
Using AI Code Generation
1import { Passed } from 'storybook-root';2import { Failed } from 'storybook-root';3import { Skipped } from 'storybook-root';4import { Pending } from 'storybook-root';5import { Undefined } from 'storybook-root';6import { Unknown } from 'storybook-root';7import { Failed } from 'storybook-root';8import { Passed } from 'storybook-root';9import { Failed } from 'storybook-root';10import { Skipped } from 'storybook-root';11import { Pending } from 'storybook-root';12import { Undefined } from 'storybook-root';13import { Unknown } from 'storybook-root';14import { Failed } from 'storybook-root';15import { Passed } from 'storybook-root';16import { Failed } from 'storybook-root';17import { Skipped } from 'storybook-root';18import { Pending } from 'storybook-root';19import { Undefined } from 'storybook-root';20import { Unknown } from 'storybook-root';21import { Failed } from 'storybook-root';22import { Passed } from 'storybook-root';23import { Failed } from 'storybook-root';24import { Skipped } from 'storybook-root';25import { Pending } from 'storybook-root';
Using AI Code Generation
1import { Passed } from 'storybook-root';2import { Failed } from 'storybook-root';3import { Skipped } from 'storybook-root';4import { Pending } from 'storybook-root';5import { Undefined } from 'storybook-root';6import { Unknown } from 'storybook-root';7import { NotExecuted } from 'storybook-root';8import { Total } from 'storybook-root';9import { Passed } from 'storybook-root';10import { Failed } from 'storybook-root';11import { Skipped } from 'storybook-root';12import { Pending } from 'storybook-root';13import { Undefined } from 'storybook-root';14import { Unknown } from 'storybook-root';15import { NotExecuted } from 'storybook-root';16import { Total } from 'storybook-root';17import { Passed } from 'storybook-root';18import { Failed } from 'storybook-root';19import { Skipped } from 'storybook-root';20import { Pending } from 'storybook-root';21import { Undefined } from 'storybook-root';22import { Unknown } from 'storybook-root';23import { NotExecuted } from 'storybook-root';24import { Total } from 'storybook-root';25import
Using AI Code Generation
1import { Passed } from 'storybook-root';2import React from 'react';3import ReactDOM from 'react-dom';4ReactDOM.render(<Passed />, document.getElementById('root'));5import { Failed } from 'storybook-root';6import React from 'react';7import ReactDOM from 'react-dom';8ReactDOM.render(<Failed />, document.getElementById('root'));
Using AI Code Generation
1- [Passed](#passed)2 - [Parameters](#parameters)3- [Failed](#failed)4 - [Parameters](#parameters-1)5- [Skipped](#skipped)6 - [Parameters](#parameters-2)7- [Pending](#pending)8 - [Parameters](#parameters-3)9- [Unknown](#unknown)10 - [Parameters](#parameters-4)11- [Data](#data)12 - [Parameters](#parameters-5)13- [Error](#error)14 - [Parameters](#parameters-6)15- [Step](#step)16 - [Parameters](#parameters-7)17- [Scenario](#scenario)18 - [Parameters](#parameters-8)19- [ScenarioOutline](#scenariooutline)20 - [Parameters](#parameters-9)21- [Feature](#feature)22 - [Parameters](#parameters-10)23- [GherkinDocument](#gherkindocument)24 - [Parameters](#parameters-11)25- [GherkinDocument](#gherkindocument-1)26 - [Parameters](#parameters-12)27- [GherkinDocument](#gherkindocument-2)28 - [Parameters](#parameters-13)29- [GherkinDocument](#gherkindocument-3)30 - [Parameters](#
Using AI Code Generation
1import { Passed } from 'storybook-root';2Passed();3import { Failed } from 'storybook-root';4Failed();5import { Test } from 'storybook-root';6Test();7import { configure } from '@storybook/react';8import { setOptions } from '@storybook/addon-options';9setOptions({10});11const req = require.context('../src', true, /.stories.js$/);12function loadStories() {13 req.keys().forEach(filename => req(filename));14}15configure(loadStories, module);16{17 "scripts": {18 }19}20const path = require('path');21const rootPath = path.resolve(__dirname, '../');22module.exports = (baseConfig, env, defaultConfig) => {23 defaultConfig.resolve.alias['storybook-root'] = rootPath;24 return defaultConfig;25};26import { Passed, Failed, Test } from 'storybook-root';27Passed();28MIT © [Saswat Samal](
Using AI Code Generation
1import { Passed } from 'storybook-root'2Passed("test passed")3Failed("test failed")4Pending("test pending")5Skipped("test skipped")6Info("test info")7Warn("test warn")8Debug("test debug")9Trace("test trace")10Fatal("test fatal")11Error("test error")12Step("test step")13Step("test step", "PASSED")14Step("test step", "FAILED")15Step("test step", "PENDING")16Step("test step", "SKIPPED")17Step("test step", "INFO")18Step("test step", "WARN")19Step("test step", "DEBUG")20Step("test step", "TRACE")21Step("test step", "FATAL")22Step("test step", "ERROR")23Step("test step", "STEP")24Step("test step", "PASSED", "test passed")25Step("test step", "FAILED", "test failed")26Step("test step", "PENDING", "test pending")27Step("test step", "SKIPPED", "test skipped")
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!