How to use success method in fast-check-monorepo

Best JavaScript code snippet using fast-check-monorepo

BackgroundGeolocation.js

Source:BackgroundGeolocation.js Github

copy

Full Screen

...85 if (callbacks.hasOwnProperty(callbackId) && callbackId.match(re)) {86 delete callbacks[callbackId];87 }88 }89 success(response);90 }91 exec(mySuccess,92 failure,93 MODULE_NAME,94 'removeListeners',95 []96 );97 },98 getState: function(success, failure) {99 exec(success || function() {},100 failure || function() {},101 MODULE_NAME,102 'getState',103 []104 );105 },106 start: function(success, failure, config) {107 exec(success || function() {},108 failure || function() {},109 MODULE_NAME,110 'start',111 []);112 },113 stop: function(success, failure, config) {114 exec(success || function() {},115 failure || function() {},116 MODULE_NAME,117 'stop',118 []);119 },120 startSchedule: function(success, failure) {121 exec(success || function() {},122 failure || function() {},123 MODULE_NAME,124 'startSchedule',125 []);126 },127 stopSchedule: function(success, failure) {128 exec(success || function() {},129 failure || function() {},130 MODULE_NAME,131 'stopSchedule',132 []);133 },134 startGeofences: function(success, failure) {135 exec(success || function() {},136 failure || function() {},137 MODULE_NAME,138 'startGeofences',139 []);140 },141 startBackgroundTask: function(callback) {142 if (typeof(callback) !== 'function') {143 throw "startBackgroundTask must be provided with a callbackFn to receive the returned #taskId";144 }145 exec(callback,146 function() {},147 MODULE_NAME,148 'startBackgroundTask',149 []);150 },151 finish: function(taskId, success, failure) {152 if (typeof(taskId) !== 'number') {153 throw "BackgroundGeolocation#finish must now be provided with a taskId as 1st param, eg: bgGeo.finish(taskId). taskId is provided by 2nd param in callback";154 }155 if (taskId === 0) {156 return;157 }158 exec(success || function() {},159 failure || function() {},160 MODULE_NAME,161 'finish',162 [taskId]);163 },164 error: function(taskId, message) {165 if (typeof(taskId) !== 'number') {166 throw "BackgroundGeolocation#error must now be provided with a taskId as 1st param, eg: bgGeo.finish(taskId). taskId is provided by 2nd param in callback";167 }168 exec(function() {},169 function() {},170 MODULE_NAME,171 'error',172 [taskId, message]);173 },174 changePace: function(isMoving, success, failure) {175 exec(success || function() {},176 failure || function() {},177 MODULE_NAME,178 'changePace',179 [isMoving]);180 },181 setConfig: function(config, success, failure) {182 if (typeof(config) === 'function') {183 console.warn('The signature for #setConfig has changed: You now provide the {} as the 1st parameter. ie: setConfig(config, success, failure');184 var _config = failure, _success = config, _failure = success;185 config = _config;186 success = _success;187 failure = _failure;188 }189 this._apply(this.config, config);190 exec(success || function() {},191 failure || function() {},192 MODULE_NAME,193 'setConfig',194 [config]);195 },196 /**197 * Returns current stationaryLocation if available. null if not198 */199 getStationaryLocation: function(success, failure) {200 exec(success || function() {},201 failure || function() {},202 MODULE_NAME,203 'getStationaryLocation',204 []);205 },206 onLocation: function(success, failure) {207 if (typeof(success) !== 'function') {208 throw "A callback must be provided";209 }210 var me = this;211 var mySuccess = function(params) {212 var location = params.location || params;213 var taskId = params.taskId || 0;214 // Transform timestamp to Date instance.215 if (location.timestamp) {216 location.timestamp = new Date(location.timestamp);217 }218 me._runBackgroundTask(taskId, function() {219 success.call(this, location, taskId);220 });221 }222 exec(mySuccess,223 failure || function() {},224 MODULE_NAME,225 'addLocationListener',226 []227 );228 },229 /**230 * Add a movement-state-change listener. Whenever the devices enters "stationary" or "moving" mode, your #success callback will be executed with #location param containing #radius of region231 * @param {Function} success232 * @param {Function} failure [optional] NOT IMPLEMENTED233 */234 onMotionChange: function(success, failure) {235 var me = this;236 success = success || function(isMoving, location, taskId) {237 me.finish(taskId);238 };239 var callback = function(params) {240 var isMoving = params.isMoving;241 var location = params.location;242 var taskId = params.taskId || 0;243 if (!isMoving) {244 me.stationaryLocation = location;245 }246 // Transform timestamp to Date instance.247 if (location.timestamp) {248 location.timestamp = new Date(location.timestamp);249 }250 me._runBackgroundTask(taskId, function() {251 success.call(me, isMoving, location, taskId);252 }, failure);253 };254 exec(callback,255 failure || function() {},256 MODULE_NAME,257 'addMotionChangeListener',258 []);259 },260 onActivityChange: function(success) {261 exec(success || function() {},262 function() {},263 MODULE_NAME,264 'addActivityChangeListener',265 []);266 },267 onProviderChange: function(success) {268 exec(success || function() {},269 function() {},270 MODULE_NAME,271 'addProviderChangeListener',272 []);273 },274 onGeofencesChange: function(success) {275 exec(success || function() {},276 function() {},277 MODULE_NAME,278 'addListener',279 ['geofenceschange']);280 },281 onHeartbeat: function(success, failure) {282 exec(success || function() {},283 failure || function() {},284 MODULE_NAME,285 'addHeartbeatListener',286 []);287 },288 onSchedule: function(success, failure) {289 exec(success || function() {},290 failure || function() {},291 MODULE_NAME,292 'addScheduleListener',293 []);294 },295 getLocations: function(success, failure) {296 if (typeof(success) !== 'function') {297 throw "BackgroundGeolocation#getLocations requires a success callback";298 }299 var me = this;300 var mySuccess = function(params) {301 var taskId = params.taskId;302 var locations = me._setTimestamp(params.locations);303 me._runBackgroundTask(taskId, function() {304 success.call(me, locations, taskId);305 });306 }307 exec(mySuccess,308 failure || function() {},309 MODULE_NAME,310 'getLocations',311 []);312 },313 getCount: function(success, failure) {314 exec(success||function(){},315 failure || function() {},316 MODULE_NAME,317 'getCount',318 []);319 },320 // @deprecated321 clearDatabase: function(success, failure) {322 this.destroyLocations(success, failure);323 },324 destroyLocations: function(success, failure) {325 exec(success||function(){},326 failure || function() {},327 MODULE_NAME,328 'destroyLocations',329 []);330 },331 insertLocation: function(location, success, failure) {332 location = location || {};333 var coords = location.coords || {};334 if (!coords.latitude && !coords.longitude) {335 throw "BackgroundGeolocation#insertLocation location must contain coords.latitude & coords.longitude";336 }337 exec(success || function() {},338 failure || function() {},339 MODULE_NAME,340 'insertLocation',341 [location]);342 },343 /**344 * Signal native plugin to sync locations queue to HTTP345 */346 sync: function(success, failure) {347 if (typeof(success) !== 'function') {348 throw "BackgroundGeolocation#sync requires a success callback";349 }350 var me = this;351 var mySuccess = function(params) {352 var locations = me._setTimestamp(params.locations);353 var taskId = params.taskId;354 me._runBackgroundTask(taskId, function() {355 success.call(me, locations, taskId);356 });357 }358 exec(mySuccess,359 failure || function() {},360 MODULE_NAME,361 'sync',362 []);363 },364 onHttp: function(success, failure) {365 exec(success || function() {},366 failure || function() {},367 MODULE_NAME,368 'addHttpListener',369 []);370 },371 onLog: function(success, failure) {372 exec(success || function() {},373 failure || function() {},374 MODULE_NAME,375 'addLogListener',376 []);377 },378 /**379 * Fetch current odometer value380 */381 getOdometer: function(success, failure) {382 exec(success || function() {},383 failure || function() {},384 MODULE_NAME,385 'getOdometer',386 []);387 },388 /**389 * Reset Odometer to 0390 */391 resetOdometer: function(success, failure) {392 exec(success || function() {},393 failure || function() {},394 MODULE_NAME,395 'setOdometer',396 [0]);397 },398 setOdometer: function(value, success, failure) {399 exec(success || function() {},400 failure || function() {},401 MODULE_NAME,402 'setOdometer',403 [value]);404 },405 /**406 * add geofence407 */408 addGeofence: function(config, success, failure) {409 config = config || {};410 if (!config.identifier) {411 throw "#addGeofence requires an 'identifier'";412 }413 if (!(config.latitude && config.longitude)) {414 throw "#addGeofence requires a #latitude and #longitude";415 }416 if (!config.radius) {417 throw "#addGeofence requires a #radius";418 }419 if ( (typeof(config.notifyOnEntry) === 'undefined') && (typeof(config.notifyOnExit) === 'undefined') ) {420 throw "#addGeofence requires at least notifyOnEntry {Boolean} and/or #notifyOnExit {Boolean}";421 }422 exec(success || function() {},423 failure || function() {},424 MODULE_NAME,425 'addGeofence',426 [config]);427 },428 /**429 * add a list of geofences430 */431 addGeofences: function(geofences, success, failure) {432 geofences = geofences || [];433 exec(success || function() {},434 failure || function() {},435 MODULE_NAME,436 'addGeofences',437 [geofences]);438 },439 /**440 * Remove all geofences441 */442 removeGeofences: function(identifiers, success, failure) {443 if (arguments.length === 0) {444 identifiers = [];445 success = function() {};446 failure = function() {};447 } else if (typeof(identifiers) === 'function') {448 failure = success;449 success = identifiers;450 identifiers = [];451 }452 exec(success || function() {},453 failure || function() {},454 MODULE_NAME,455 'removeGeofences',456 [identifiers]);457 },458 /**459 * remove a geofence460 * @param {String} identifier461 */462 removeGeofence: function(identifier, success, failure) {463 if (!identifier) {464 throw "#removeGeofence requires an 'identifier'";465 }466 exec(success || function() {},467 failure || function() {},468 MODULE_NAME,469 'removeGeofence',470 [identifier]);471 },472 onGeofence: function(success, failure) {473 if (!typeof(success) === 'function') {474 throw "#onGeofence requires a success callback";475 }476 var me = this;477 var mySuccess = function(params) {478 var taskId = params.taskId || 0;479 delete(params.taskId);480 me._runBackgroundTask(taskId, function() {481 success.call(me, params, taskId);482 }, failure);483 };484 exec(mySuccess,485 failure || function() {},486 MODULE_NAME,487 'onGeofence',488 []);489 },490 /**491 * Fetch a list of all monitored geofences492 */493 getGeofences: function(success, failure) {494 exec(success || function() {},495 failure || function() {},496 MODULE_NAME,497 'getGeofences',498 []);499 },500 /**501 * Fetch the current position502 */503 getCurrentPosition: function(success, failure, options) {504 var me = this;505 options = options || {};506 success = success || function(location, taskId) {507 me.finish(taskId);508 };509 var mySuccess = function(params) {510 var location = params.location || params;511 var taskId = params.taskId || 0;512 // Transform timestamp to Date instance.513 if (location.timestamp) {514 location.timestamp = new Date(location.timestamp);515 }516 me._runBackgroundTask(taskId, function() {517 success.call(this, location, taskId);518 });519 }520 exec(mySuccess || function() {},521 failure || function() {},522 MODULE_NAME,523 'getCurrentPosition',524 [options]);525 },526 watchPosition: function(success, failure, options) {527 var me = this;528 options = options || {};529 success = success || function(location) {};530 var mySuccess = function(location) {531 // Transform timestamp to Date instance.532 if (location.timestamp) {533 location.timestamp = new Date(location.timestamp);534 }535 success(location);536 }537 exec(mySuccess || function() {},538 failure || function() {},539 MODULE_NAME,540 'watchPosition',541 [options]);542 },543 stopWatchPosition: function(success, failure, options) {544 var success = success || function() {};545 var failure = failure || function() {};546 var mySuccess = function(watchCallbacks) {547 var callbacks = window.cordova.callbacks;548 for (var n=0,len=watchCallbacks.length;n<len;n++) {549 var callbackId = watchCallbacks[n];550 if (callbacks[callbackId]) {551 delete callbacks[callbackId];552 } else {553 console.warn(MODULE_NAME + '#stopWatchPosition failed to locate callbackId: ', callbackId);554 }555 }556 success();557 };558 exec(mySuccess,559 failure,560 MODULE_NAME,561 'stopWatchPosition',562 []);563 },564 setLogLevel: function(logLevel, success, failure) {565 var success = success || function() {};566 var failure = failure || function() {};567 exec(success,568 failure,569 MODULE_NAME,570 'setLogLevel',...

Full Screen

Full Screen

XPathResult_TYPE_ERR.js

Source:XPathResult_TYPE_ERR.js Github

copy

Full Screen

1/*2Copyright © 2001-2004 World Wide Web Consortium, 3(Massachusetts Institute of Technology, European Research Consortium 4for Informatics and Mathematics, Keio University). All 5Rights Reserved. This work is distributed under the W3C® Software License [1] in the 6hope that it will be useful, but WITHOUT ANY WARRANTY; without even 7the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-200212319*/10// expose test function names11function exposeTestFunctionNames()12{13return ['XPathResult_TYPE_ERR'];14}15var docsLoaded = -1000000;16var builder = null;17//18// This function is called by the testing framework before19// running the test suite.20//21// If there are no configuration exceptions, asynchronous22// document loading is started. Otherwise, the status23// is set to complete and the exception is immediately24// raised when entering the body of the test.25//26function setUpPage() {27 setUpPageStatus = 'running';28 try {29 //30 // creates test document builder, may throw exception31 //32 builder = createConfiguredBuilder();33 docsLoaded = 0;34 35 var docRef = null;36 if (typeof(this.doc) != 'undefined') {37 docRef = this.doc;38 }39 docsLoaded += preload(docRef, "doc", "staff");40 41 if (docsLoaded == 1) {42 setUpPageStatus = 'complete';43 }44 } catch(ex) {45 catchInitializationError(builder, ex);46 setUpPageStatus = 'complete';47 }48}49//50// This method is called on the completion of 51// each asychronous load started in setUpTests.52//53// When every synchronous loaded document has completed,54// the page status is changed which allows the55// body of the test to be executed.56function loadComplete() {57 if (++docsLoaded == 1) {58 setUpPageStatus = 'complete';59 }60}61/**62* 63 Create an XPathResult for the expression /staff/employee64 for each type of XPathResultType, checking that TYPE_ERR65 is thrown when inappropriate properties and methods are accessed.66 67* @author Bob Clary68* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#TYPE_ERR69* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathException70* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult71* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResultType72* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathEvaluator-createNSResolver73* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-resultType74* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-booleanValue75* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-numberValue76* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-singleNodeValue77* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-snapshot-length78* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-stringValue79* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-iterateNext80* @see http://www.w3.org/TR/2003/CR-DOM-Level-3-XPath-20030331/xpath#XPathResult-snapshotItem81*/82function XPathResult_TYPE_ERR() {83 var success;84 if(checkInitialization(builder, "XPathResult_TYPE_ERR") != null) return;85 var doc;86 var resolver;87 var evaluator;88 var expression = "/staff/employee";89 var contextNode;90 var inresult = null;91 var outresult = null;92 var inNodeType;93 var outNodeType;94 var ANY_TYPE = 0;95 var NUMBER_TYPE = 1;96 var STRING_TYPE = 2;97 var BOOLEAN_TYPE = 3;98 var UNORDERED_NODE_ITERATOR_TYPE = 4;99 var ORDERED_NODE_ITERATOR_TYPE = 5;100 var UNORDERED_NODE_SNAPSHOT_TYPE = 6;101 var ORDERED_NODE_SNAPSHOT_TYPE = 7;102 var ANY_UNORDERED_NODE_TYPE = 8;103 var FIRST_ORDERED_NODE_TYPE = 9;104 var booleanValue;105 var shortValue;106 var intValue;107 var doubleValue;108 var nodeValue;109 var stringValue;110 nodeTypeList = new Array();111 nodeTypeList[0] = 0;112 nodeTypeList[1] = 1;113 nodeTypeList[2] = 2;114 nodeTypeList[3] = 3;115 nodeTypeList[4] = 4;116 nodeTypeList[5] = 5;117 nodeTypeList[6] = 6;118 nodeTypeList[7] = 7;119 nodeTypeList[8] = 8;120 nodeTypeList[9] = 9;121 122 var docRef = null;123 if (typeof(this.doc) != 'undefined') {124 docRef = this.doc;125 }126 doc = load(docRef, "doc", "staff");127 evaluator = createXPathEvaluator(doc);128resolver = evaluator.createNSResolver(doc);129 contextNode = doc;130for(var indexN65778 = 0;indexN65778 < nodeTypeList.length; indexN65778++) {131 inNodeType = nodeTypeList[indexN65778];132 outresult = evaluator.evaluate(expression,contextNode,resolver,inNodeType,inresult);133 outNodeType = outresult.resultType;134 135 if(136 (outNodeType == NUMBER_TYPE)137 ) {138 139 {140 success = false;141 try {142 booleanValue = outresult.booleanValue;143 }144 catch(ex) { 145 success = (typeof(ex.code) != 'undefined' && ex.code == 52);146 }147 assertTrue("number_booleanValue_TYPE_ERR",success);148 }149 {150 success = false;151 try {152 nodeValue = outresult.singleNodeValue;153 }154 catch(ex) { 155 success = (typeof(ex.code) != 'undefined' && ex.code == 52);156 }157 assertTrue("number_singleNodeValue_TYPE_ERR",success);158 }159 {160 success = false;161 try {162 intValue = outresult.snapshotLength;163 }164 catch(ex) { 165 success = (typeof(ex.code) != 'undefined' && ex.code == 52);166 }167 assertTrue("number_snapshotLength_TYPE_ERR",success);168 }169 {170 success = false;171 try {172 stringValue = outresult.stringValue;173 }174 catch(ex) { 175 success = (typeof(ex.code) != 'undefined' && ex.code == 52);176 }177 assertTrue("number_stringValue_TYPE_ERR",success);178 }179 {180 success = false;181 try {182 nodeValue = outresult.iterateNext();183 }184 catch(ex) { 185 success = (typeof(ex.code) != 'undefined' && ex.code == 52);186 }187 assertTrue("number_iterateNext_TYPE_ERR",success);188 }189 {190 success = false;191 try {192 nodeValue = outresult.snapshotItem(0);193 }194 catch(ex) { 195 success = (typeof(ex.code) != 'undefined' && ex.code == 52);196 }197 assertTrue("number_snapshotItem_TYPE_ERR",success);198 }199 }200 201 if(202 (outNodeType == STRING_TYPE)203 ) {204 205 {206 success = false;207 try {208 booleanValue = outresult.booleanValue;209 }210 catch(ex) { 211 success = (typeof(ex.code) != 'undefined' && ex.code == 52);212 }213 assertTrue("string_booleanValue_TYPE_ERR",success);214 }215 {216 success = false;217 try {218 doubleValue = outresult.numberValue;219 }220 catch(ex) { 221 success = (typeof(ex.code) != 'undefined' && ex.code == 52);222 }223 assertTrue("string_numberValue_TYPE_ERR",success);224 }225 {226 success = false;227 try {228 nodeValue = outresult.singleNodeValue;229 }230 catch(ex) { 231 success = (typeof(ex.code) != 'undefined' && ex.code == 52);232 }233 assertTrue("string_singleNodeValue_TYPE_ERR",success);234 }235 {236 success = false;237 try {238 intValue = outresult.snapshotLength;239 }240 catch(ex) { 241 success = (typeof(ex.code) != 'undefined' && ex.code == 52);242 }243 assertTrue("string_snapshotLength_TYPE_ERR",success);244 }245 {246 success = false;247 try {248 nodeValue = outresult.iterateNext();249 }250 catch(ex) { 251 success = (typeof(ex.code) != 'undefined' && ex.code == 52);252 }253 assertTrue("string_iterateNext_TYPE_ERR",success);254 }255 {256 success = false;257 try {258 nodeValue = outresult.snapshotItem(0);259 }260 catch(ex) { 261 success = (typeof(ex.code) != 'undefined' && ex.code == 52);262 }263 assertTrue("string_snapshotItem_TYPE_ERR",success);264 }265 }266 267 if(268 (outNodeType == BOOLEAN_TYPE)269 ) {270 271 {272 success = false;273 try {274 doubleValue = outresult.numberValue;275 }276 catch(ex) { 277 success = (typeof(ex.code) != 'undefined' && ex.code == 52);278 }279 assertTrue("boolean_numberValue_TYPE_ERR",success);280 }281 {282 success = false;283 try {284 nodeValue = outresult.singleNodeValue;285 }286 catch(ex) { 287 success = (typeof(ex.code) != 'undefined' && ex.code == 52);288 }289 assertTrue("boolean_singleNodeValue_TYPE_ERR",success);290 }291 {292 success = false;293 try {294 intValue = outresult.snapshotLength;295 }296 catch(ex) { 297 success = (typeof(ex.code) != 'undefined' && ex.code == 52);298 }299 assertTrue("boolean_snapshotLength_TYPE_ERR",success);300 }301 {302 success = false;303 try {304 stringValue = outresult.stringValue;305 }306 catch(ex) { 307 success = (typeof(ex.code) != 'undefined' && ex.code == 52);308 }309 assertTrue("boolean_stringValue_TYPE_ERR",success);310 }311 {312 success = false;313 try {314 nodeValue = outresult.iterateNext();315 }316 catch(ex) { 317 success = (typeof(ex.code) != 'undefined' && ex.code == 52);318 }319 assertTrue("boolean_iterateNext_TYPE_ERR",success);320 }321 {322 success = false;323 try {324 nodeValue = outresult.snapshotItem(0);325 }326 catch(ex) { 327 success = (typeof(ex.code) != 'undefined' && ex.code == 52);328 }329 assertTrue("boolean_snapshotItem_TYPE_ERR",success);330 }331 }332 333 if(334 (outNodeType == UNORDERED_NODE_ITERATOR_TYPE)335 ) {336 337 {338 success = false;339 try {340 booleanValue = outresult.booleanValue;341 }342 catch(ex) { 343 success = (typeof(ex.code) != 'undefined' && ex.code == 52);344 }345 assertTrue("unordered_node_iterator_booleanValue_TYPE_ERR",success);346 }347 {348 success = false;349 try {350 doubleValue = outresult.numberValue;351 }352 catch(ex) { 353 success = (typeof(ex.code) != 'undefined' && ex.code == 52);354 }355 assertTrue("unordered_node_iterator_numberValue_TYPE_ERR",success);356 }357 {358 success = false;359 try {360 nodeValue = outresult.singleNodeValue;361 }362 catch(ex) { 363 success = (typeof(ex.code) != 'undefined' && ex.code == 52);364 }365 assertTrue("unordered_node_iterator_singleNodeValue_TYPE_ERR",success);366 }367 {368 success = false;369 try {370 intValue = outresult.snapshotLength;371 }372 catch(ex) { 373 success = (typeof(ex.code) != 'undefined' && ex.code == 52);374 }375 assertTrue("unordered_node_iterator_snapshotLength_TYPE_ERR",success);376 }377 {378 success = false;379 try {380 stringValue = outresult.stringValue;381 }382 catch(ex) { 383 success = (typeof(ex.code) != 'undefined' && ex.code == 52);384 }385 assertTrue("unordered_node_iterator_stringValue_TYPE_ERR",success);386 }387 {388 success = false;389 try {390 nodeValue = outresult.snapshotItem(0);391 }392 catch(ex) { 393 success = (typeof(ex.code) != 'undefined' && ex.code == 52);394 }395 assertTrue("unordered_node_iterator_snapshotItem_TYPE_ERR",success);396 }397 }398 399 if(400 (outNodeType == ORDERED_NODE_ITERATOR_TYPE)401 ) {402 403 {404 success = false;405 try {406 booleanValue = outresult.booleanValue;407 }408 catch(ex) { 409 success = (typeof(ex.code) != 'undefined' && ex.code == 52);410 }411 assertTrue("ordered_node_iterator_booleanValue_TYPE_ERR",success);412 }413 {414 success = false;415 try {416 doubleValue = outresult.numberValue;417 }418 catch(ex) { 419 success = (typeof(ex.code) != 'undefined' && ex.code == 52);420 }421 assertTrue("ordered_node_iterator_numberValue_TYPE_ERR",success);422 }423 {424 success = false;425 try {426 nodeValue = outresult.singleNodeValue;427 }428 catch(ex) { 429 success = (typeof(ex.code) != 'undefined' && ex.code == 52);430 }431 assertTrue("ordered_node_iterator_singleNodeValue_TYPE_ERR",success);432 }433 {434 success = false;435 try {436 intValue = outresult.snapshotLength;437 }438 catch(ex) { 439 success = (typeof(ex.code) != 'undefined' && ex.code == 52);440 }441 assertTrue("ordered_node_iterator_snapshotLength_TYPE_ERR",success);442 }443 {444 success = false;445 try {446 stringValue = outresult.stringValue;447 }448 catch(ex) { 449 success = (typeof(ex.code) != 'undefined' && ex.code == 52);450 }451 assertTrue("ordered_node_iterator_stringValue_TYPE_ERR",success);452 }453 {454 success = false;455 try {456 nodeValue = outresult.snapshotItem(0);457 }458 catch(ex) { 459 success = (typeof(ex.code) != 'undefined' && ex.code == 52);460 }461 assertTrue("ordered_node_iterator_snapshotItem_TYPE_ERR",success);462 }463 }464 465 if(466 (outNodeType == UNORDERED_NODE_SNAPSHOT_TYPE)467 ) {468 469 {470 success = false;471 try {472 booleanValue = outresult.booleanValue;473 }474 catch(ex) { 475 success = (typeof(ex.code) != 'undefined' && ex.code == 52);476 }477 assertTrue("unordered_node_snapshot_booleanValue_TYPE_ERR",success);478 }479 {480 success = false;481 try {482 doubleValue = outresult.numberValue;483 }484 catch(ex) { 485 success = (typeof(ex.code) != 'undefined' && ex.code == 52);486 }487 assertTrue("unordered_node_snapshot_numberValue_TYPE_ERR",success);488 }489 {490 success = false;491 try {492 nodeValue = outresult.singleNodeValue;493 }494 catch(ex) { 495 success = (typeof(ex.code) != 'undefined' && ex.code == 52);496 }497 assertTrue("unordered_node_snapshot_singleNodeValue_TYPE_ERR",success);498 }499 {500 success = false;501 try {502 stringValue = outresult.stringValue;503 }504 catch(ex) { 505 success = (typeof(ex.code) != 'undefined' && ex.code == 52);506 }507 assertTrue("unordered_node_snapshot_stringValue_TYPE_ERR",success);508 }509 {510 success = false;511 try {512 nodeValue = outresult.iterateNext();513 }514 catch(ex) { 515 success = (typeof(ex.code) != 'undefined' && ex.code == 52);516 }517 assertTrue("unordered_node_snapshot_iterateNext_TYPE_ERR",success);518 }519 }520 521 if(522 (outNodeType == ORDERED_NODE_SNAPSHOT_TYPE)523 ) {524 525 {526 success = false;527 try {528 booleanValue = outresult.booleanValue;529 }530 catch(ex) { 531 success = (typeof(ex.code) != 'undefined' && ex.code == 52);532 }533 assertTrue("ordered_node_snapshot_booleanValue_TYPE_ERR",success);534 }535 {536 success = false;537 try {538 doubleValue = outresult.numberValue;539 }540 catch(ex) { 541 success = (typeof(ex.code) != 'undefined' && ex.code == 52);542 }543 assertTrue("ordered_node_snapshot_numberValue_TYPE_ERR",success);544 }545 {546 success = false;547 try {548 nodeValue = outresult.singleNodeValue;549 }550 catch(ex) { 551 success = (typeof(ex.code) != 'undefined' && ex.code == 52);552 }553 assertTrue("ordered_node_snapshot_singleNodeValue_TYPE_ERR",success);554 }555 {556 success = false;557 try {558 stringValue = outresult.stringValue;559 }560 catch(ex) { 561 success = (typeof(ex.code) != 'undefined' && ex.code == 52);562 }563 assertTrue("ordered_node_snapshot_stringValue_TYPE_ERR",success);564 }565 {566 success = false;567 try {568 nodeValue = outresult.iterateNext();569 }570 catch(ex) { 571 success = (typeof(ex.code) != 'undefined' && ex.code == 52);572 }573 assertTrue("ordered_node_snapshot_iterateNext_TYPE_ERR",success);574 }575 }576 577 if(578 (outNodeType == ANY_UNORDERED_NODE_TYPE)579 ) {580 581 {582 success = false;583 try {584 booleanValue = outresult.booleanValue;585 }586 catch(ex) { 587 success = (typeof(ex.code) != 'undefined' && ex.code == 52);588 }589 assertTrue("any_unordered_node_booleanValue_TYPE_ERR",success);590 }591 {592 success = false;593 try {594 doubleValue = outresult.numberValue;595 }596 catch(ex) { 597 success = (typeof(ex.code) != 'undefined' && ex.code == 52);598 }599 assertTrue("any_unordered_node_numberValue_TYPE_ERR",success);600 }601 {602 success = false;603 try {604 intValue = outresult.snapshotLength;605 }606 catch(ex) { 607 success = (typeof(ex.code) != 'undefined' && ex.code == 52);608 }609 assertTrue("any_unordered_node_snapshotLength_TYPE_ERR",success);610 }611 {612 success = false;613 try {614 stringValue = outresult.stringValue;615 }616 catch(ex) { 617 success = (typeof(ex.code) != 'undefined' && ex.code == 52);618 }619 assertTrue("any_unordered_node_stringValue_TYPE_ERR",success);620 }621 {622 success = false;623 try {624 nodeValue = outresult.iterateNext();625 }626 catch(ex) { 627 success = (typeof(ex.code) != 'undefined' && ex.code == 52);628 }629 assertTrue("any_unordered_node_iterateNext_TYPE_ERR",success);630 }631 {632 success = false;633 try {634 nodeValue = outresult.snapshotItem(0);635 }636 catch(ex) { 637 success = (typeof(ex.code) != 'undefined' && ex.code == 52);638 }639 assertTrue("any_unordered_node_snapshotItem_TYPE_ERR",success);640 }641 }642 643 if(644 (outNodeType == FIRST_ORDERED_NODE_TYPE)645 ) {646 647 {648 success = false;649 try {650 booleanValue = outresult.booleanValue;651 }652 catch(ex) { 653 success = (typeof(ex.code) != 'undefined' && ex.code == 52);654 }655 assertTrue("first_ordered_node_booleanValue_TYPE_ERR",success);656 }657 {658 success = false;659 try {660 doubleValue = outresult.numberValue;661 }662 catch(ex) { 663 success = (typeof(ex.code) != 'undefined' && ex.code == 52);664 }665 assertTrue("first_ordered_node_numberValue_TYPE_ERR",success);666 }667 {668 success = false;669 try {670 intValue = outresult.snapshotLength;671 }672 catch(ex) { 673 success = (typeof(ex.code) != 'undefined' && ex.code == 52);674 }675 assertTrue("first_ordered_node_snapshotLength_TYPE_ERR",success);676 }677 {678 success = false;679 try {680 stringValue = outresult.stringValue;681 }682 catch(ex) { 683 success = (typeof(ex.code) != 'undefined' && ex.code == 52);684 }685 assertTrue("first_ordered_node_stringValue_TYPE_ERR",success);686 }687 {688 success = false;689 try {690 nodeValue = outresult.iterateNext();691 }692 catch(ex) { 693 success = (typeof(ex.code) != 'undefined' && ex.code == 52);694 }695 assertTrue("first_ordered_node_iterateNext_TYPE_ERR",success);696 }697 {698 success = false;699 try {700 nodeValue = outresult.snapshotItem(0);701 }702 catch(ex) { 703 success = (typeof(ex.code) != 'undefined' && ex.code == 52);704 }705 assertTrue("first_ordered_node_snapshotItem_TYPE_ERR",success);706 }707 }708 709 }710 711}712function runTest() {713 XPathResult_TYPE_ERR();...

Full Screen

Full Screen

localauthenticator_test.py

Source:localauthenticator_test.py Github

copy

Full Screen

1# Copyright 2016 Google Inc. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14"""Tests for pyu2f.convenience.localauthenticator."""15import base6416import sys17import mock18from pyu2f import errors19from pyu2f import model20from pyu2f.convenience import localauthenticator21if sys.version_info[:2] < (2, 7):22 import unittest2 as unittest # pylint: disable=g-import-not-at-top23else:24 import unittest # pylint: disable=g-import-not-at-top25# Input/ouput values recorded from a successful signing flow26SIGN_SUCCESS = {27 'app_id': 'test_app_id',28 'app_id_hash_encoded': 'TnMguTdPn7OcIO9f-0CgfQdY254bvc6WR-DTPZnJ49w=',29 'challenge': b'asdfasdf',30 'challenge_hash_encoded': 'qhJtbTQvsU0BmLLpDWes-3zFGbegR2wp1mv5BJ2BwC0=',31 'key_handle_encoded': ('iBbl9-VYt-XSdWeHVNX-gfQcXGzlrAQ7BcngVNUxWijIQQlnZEI'32 '4Vb0Bp2ydBCbIQu_5rNlKqPH6NK1TtnM7fA=='),33 'origin': 'test_origin',34 'signature_data_encoded': ('AQAAAI8wRQIhALlIPo6Hg8HwzELdYRIXnAnpsiHYCSXHex'35 'CS34eiS2ixAiBt3TRmKE1A9WyMjc3JGrGI7gSPg-QzDSNL'36 'aIj7JwcCTA=='),37 'client_data_encoded': ('eyJjaGFsbGVuZ2UiOiAiWVhOa1ptRnpaR1kiLCAib3JpZ2luI'38 'jogInRlc3Rfb3JpZ2luIiwgInR5cCI6ICJuYXZpZ2F0b3IuaW'39 'QuZ2V0QXNzZXJ0aW9uIn0='),40 'u2f_version': 'U2F_V2'41}42SIGN_SUCCESS['registered_key'] = model.RegisteredKey(43 base64.urlsafe_b64decode(SIGN_SUCCESS['key_handle_encoded']))44SIGN_SUCCESS['client_data'] = model.ClientData(45 model.ClientData.TYP_AUTHENTICATION,46 SIGN_SUCCESS['challenge'],47 SIGN_SUCCESS['origin'])48@mock.patch.object(sys, 'stderr', new=mock.MagicMock())49class LocalAuthenticatorTest(unittest.TestCase):50 @mock.patch.object(localauthenticator.u2f, 'GetLocalU2FInterface')51 def testSignSuccess(self, mock_get_u2f_method):52 """Test successful signing with a valid key."""53 # Prepare u2f mocks54 mock_u2f = mock.MagicMock()55 mock_get_u2f_method.return_value = mock_u2f56 mock_authenticate = mock.MagicMock()57 mock_u2f.Authenticate = mock_authenticate58 mock_authenticate.return_value = model.SignResponse(59 base64.urlsafe_b64decode(SIGN_SUCCESS['key_handle_encoded']),60 base64.urlsafe_b64decode(SIGN_SUCCESS['signature_data_encoded']),61 SIGN_SUCCESS['client_data']62 )63 # Call LocalAuthenticator64 challenge_data = [{'key': SIGN_SUCCESS['registered_key'],65 'challenge': SIGN_SUCCESS['challenge']}]66 authenticator = localauthenticator.LocalAuthenticator('testorigin')67 self.assertTrue(authenticator.IsAvailable())68 response = authenticator.Authenticate(SIGN_SUCCESS['app_id'],69 challenge_data)70 # Validate that u2f authenticate was called with the correct values71 self.assertTrue(mock_authenticate.called)72 authenticate_args = mock_authenticate.call_args[0]73 self.assertEqual(len(authenticate_args), 3)74 self.assertEqual(authenticate_args[0], SIGN_SUCCESS['app_id'])75 self.assertEqual(authenticate_args[1], SIGN_SUCCESS['challenge'])76 registered_keys = authenticate_args[2]77 self.assertEqual(len(registered_keys), 1)78 self.assertEqual(registered_keys[0], SIGN_SUCCESS['registered_key'])79 # Validate authenticator response80 self.assertEquals(response.get('clientData'),81 SIGN_SUCCESS['client_data_encoded'])82 self.assertEquals(response.get('signatureData'),83 SIGN_SUCCESS['signature_data_encoded'])84 self.assertEquals(response.get('applicationId'),85 SIGN_SUCCESS['app_id'])86 self.assertEquals(response.get('keyHandle'),87 SIGN_SUCCESS['key_handle_encoded'])88 @mock.patch.object(localauthenticator.u2f, 'GetLocalU2FInterface')89 def testSignMultipleIneligible(self, mock_get_u2f_method):90 """Test signing with multiple keys registered, but none eligible."""91 # Prepare u2f mocks92 mock_u2f = mock.MagicMock()93 mock_get_u2f_method.return_value = mock_u2f94 mock_authenticate = mock.MagicMock()95 mock_u2f.Authenticate = mock_authenticate96 mock_authenticate.side_effect = errors.U2FError(97 errors.U2FError.DEVICE_INELIGIBLE)98 # Call LocalAuthenticator99 challenge_item = {'key': SIGN_SUCCESS['registered_key'],100 'challenge': SIGN_SUCCESS['challenge']}101 challenge_data = [challenge_item, challenge_item]102 authenticator = localauthenticator.LocalAuthenticator('testorigin')103 with self.assertRaises(errors.U2FError) as cm:104 authenticator.Authenticate(SIGN_SUCCESS['app_id'],105 challenge_data)106 self.assertEquals(cm.exception.code, errors.U2FError.DEVICE_INELIGIBLE)107 @mock.patch.object(localauthenticator.u2f, 'GetLocalU2FInterface')108 def testSignMultipleSuccess(self, mock_get_u2f_method):109 """Test signing with multiple keys registered and one is eligible."""110 # Prepare u2f mocks111 mock_u2f = mock.MagicMock()112 mock_get_u2f_method.return_value = mock_u2f113 mock_authenticate = mock.MagicMock()114 mock_u2f.Authenticate = mock_authenticate115 return_value = model.SignResponse(116 base64.urlsafe_b64decode(SIGN_SUCCESS['key_handle_encoded']),117 base64.urlsafe_b64decode(SIGN_SUCCESS['signature_data_encoded']),118 SIGN_SUCCESS['client_data']119 )120 mock_authenticate.side_effect = [121 errors.U2FError(errors.U2FError.DEVICE_INELIGIBLE),122 return_value123 ]124 # Call LocalAuthenticator125 challenge_item = {'key': SIGN_SUCCESS['registered_key'],126 'challenge': SIGN_SUCCESS['challenge']}127 challenge_data = [challenge_item, challenge_item]128 authenticator = localauthenticator.LocalAuthenticator('testorigin')129 response = authenticator.Authenticate(SIGN_SUCCESS['app_id'],130 challenge_data)131 # Validate that u2f authenticate was called with the correct values132 self.assertTrue(mock_authenticate.called)133 authenticate_args = mock_authenticate.call_args[0]134 self.assertEqual(len(authenticate_args), 3)135 self.assertEqual(authenticate_args[0], SIGN_SUCCESS['app_id'])136 self.assertEqual(authenticate_args[1], SIGN_SUCCESS['challenge'])137 registered_keys = authenticate_args[2]138 self.assertEqual(len(registered_keys), 1)139 self.assertEqual(registered_keys[0], SIGN_SUCCESS['registered_key'])140 # Validate authenticator response141 self.assertEquals(response.get('clientData'),142 SIGN_SUCCESS['client_data_encoded'])143 self.assertEquals(response.get('signatureData'),144 SIGN_SUCCESS['signature_data_encoded'])145 self.assertEquals(response.get('applicationId'),146 SIGN_SUCCESS['app_id'])147 self.assertEquals(response.get('keyHandle'),148 SIGN_SUCCESS['key_handle_encoded'])149if __name__ == '__main__':...

Full Screen

Full Screen

response.py

Source:response.py Github

copy

Full Screen

1PROJECT_ADD_SUCCESS = {2 "code": "0001",3 "success": True,4 "msg": "项目添加成功"5}67PROJECT_EXISTS = {8 "code": "0101",9 "success": False,10 "msg": "项目已存在"11}1213PROJECT_NOT_EXISTS = {14 "code": "0102",15 "success": False,16 "msg": "项目不存在"17}1819DEBUGTALK_NOT_EXISTS = {20 "code": "0102",21 "success": False,22 "msg": "miss debugtalk"23}2425DEBUGTALK_UPDATE_SUCCESS = {26 "code": "0002",27 "success": True,28 "msg": "debugtalk更新成功"29}3031PROJECT_UPDATE_SUCCESS = {32 "code": "0002",33 "success": True,34 "msg": "项目更新成功"35}3637PROJECT_DELETE_SUCCESS = {38 "code": "0003",39 "success": True,40 "msg": "项目删除成功"41}4243SYSTEM_ERROR = {44 "code": "9999",45 "success": False,46 "msg": "System Error"47}4849TREE_ADD_SUCCESS = {50 "code": "0001",51 "success": True,52 "msg": "树形结构添加成功"53}5455TREE_UPDATE_SUCCESS = {56 "code": "0002",57 "success": True,58 "msg": "树形结构更新成功"59}6061KEY_MISS = {62 "code": "0100",63 "success": False,64 "msg": "请求数据非法"65}6667FILE_UPLOAD_SUCCESS = {68 'code': '0001',69 'success': True,70 'msg': '文件上传成功'71}7273FILE_EXISTS = {74 'code': '0101',75 'success': False,76 'msg': '文件已存在,默认使用已有文件'77}7879API_ADD_SUCCESS = {80 'code': '0001',81 'success': True,82 'msg': '接口添加成功'83}8485DATA_TO_LONG = {86 'code': '0100',87 'success': False,88 'msg': '数据信息过长!'89}9091API_NOT_FOUND = {92 'code': '0102',93 'success': False,94 'msg': '未查询到该API'95}9697API_DEL_SUCCESS = {98 'code': '0003',99 'success': True,100 'msg': 'API删除成功'101}102103REPORT_DEL_SUCCESS = {104 'code': '0003',105 'success': True,106 'msg': '报告删除成功'107}108109API_UPDATE_SUCCESS = {110 'code': '0002',111 'success': True,112 'msg': 'API更新成功'113}114115SUITE_ADD_SUCCESS = {116 'code': '0001',117 'success': True,118 'msg': 'Suite添加成功'119}120121SUITE_DEL_SUCCESS = {122 'code': '0003',123 'success': True,124 'msg': 'Suite删除成功'125}126127CASE_ADD_SUCCESS = {128 'code': '0001',129 'success': True,130 'msg': '用例添加成功'131}132133CASE_EXISTS = {134 "code": "0101",135 "success": False,136 "msg": "此节点下已存在该用例集,请重新命名"137}138139CASE_NOT_EXISTS = {140 "code": "0102",141 "success": False,142 "msg": "此用例集不存在"143}144145CASE_DELETE_SUCCESS = {146 "code": "0003",147 "success": True,148 "msg": "用例集删除成功"149}150151CASE_UPDATE_SUCCESS = {152 'code': '0002',153 'success': True,154 'msg': '用例集更新成功'155}156157CONFIG_EXISTS = {158 "code": "0101",159 "success": False,160 "msg": "此配置已存在,请重新命名"161}162163VARIABLES_EXISTS = {164 "code": "0101",165 "success": False,166 "msg": "此变量已存在,请重新命名"167}168169CONFIG_ADD_SUCCESS = {170 'code': '0001',171 'success': True,172 'msg': '环境添加成功'173}174175VARIABLES_ADD_SUCCESS = {176 'code': '0001',177 'success': True,178 'msg': '变量添加成功'179}180181CONFIG_NOT_EXISTS = {182 "code": "0102",183 "success": False,184 "msg": "指定的环境不存在"185}186187REPORT_NOT_EXISTS = {188 "code": "0102",189 "success": False,190 "msg": "指定的报告不存在"191}192193VARIABLES_NOT_EXISTS = {194 "code": "0102",195 "success": False,196 "msg": "指定的全局变量不存在"197}198199CONFIG_UPDATE_SUCCESS = {200 "code": "0002",201 "success": True,202 "msg": "环境更新成功"203}204205VARIABLES_UPDATE_SUCCESS = {206 "code": "0002",207 "success": True,208 "msg": "全局变量更新成功"209}210211TASK_ADD_SUCCESS = {212 "code": "0001",213 "success": True,214 "msg": "定时任务新增成功"215}216217TASK_TIME_ILLEGAL = {218 "code": "0101",219 "success": False,220 "msg": "时间表达式非法"221}222223TASK_HAS_EXISTS = {224 "code": "0102",225 "success": False,226 "msg": "定时任务已存在"227}228229TASK_EMAIL_ILLEGAL = {230 "code": "0102",231 "success": False,232 "msg": "请指定邮件接收人列表"233}234235TASK_DEL_SUCCESS = {236 "code": "0003",237 "success": True,238 "msg": "任务删除成功"239}240241PLAN_DEL_SUCCESS = {242 "code": "0003",243 "success": True,244 "msg": "集成计划删除成功"245}246247PLAN_ADD_SUCCESS = {248 "code": "0001",249 "success": True,250 "msg": "计划添加成功"251}252253PLAN_KEY_EXIST = {254 "code": "0101",255 "success": False,256 "msg": "该KEY值已存在,请修改KEY值"257}258259PLAN_ILLEGAL = {260 "code": "0101",261 "success": False,262 "msg": "提取字段格式错误,请检查"263}264265PLAN_UPDATE_SUCCESS = {266 "code": "0002",267 "success": True,268 "msg": "计划更新成功"269}270271HOSTIP_EXISTS = {272 "code": "0101",273 "success": False,274 "msg": "此域名已存在,请重新命名"275}276277HOSTIP_ADD_SUCCESS = {278 'code': '0001',279 'success': True,280 'msg': '域名添加成功'281}282283HOSTIP_NOT_EXISTS = {284 "code": "0102",285 "success": False,286 "msg": "指定的域名不存在"287}288289HOSTIP_EXISTS = {290 "code": "0101",291 "success": False,292 "msg": "此域名已存在,请重新命名"293}294295HOSTIP_UPDATE_SUCCESS = {296 "code": "0002",297 "success": True,298 "msg": "域名更新成功"299}300HOST_DEL_SUCCESS = {301 'code': '0003',302 'success': True,303 'msg': '域名删除成功'304}305 ...

Full Screen

Full Screen

plot.py

Source:plot.py Github

copy

Full Screen

1import _pickle as pkl2import numpy as np3import matplotlib.pyplot as plt4import h5py5from HER.plotting import update_one_plot, make_figure6# we have to load all the performance7path = "../HER/performance_up/reach_seed_up_UP_1"8file = h5py.File(path, 'r')9seed_1 = np.array(file['success_rate'])10path = "../HER/performance_up/reach_seed_up_UP_42"11file = h5py.File(path, 'r')12seed_2 = np.array(file['success_rate'])13path = "../HER/performance_up/reach_seed_up_UP_213"14file = h5py.File(path, 'r')15seed_3 = np.array(file['success_rate'])16path = "../HER/performance_up/reach_seed_up_UP_666"17file = h5py.File(path, 'r')18seed_4 = np.array(file['success_rate'])19path = "../HER/performance_up/reach_seed_up_UP_777"20file = h5py.File(path, 'r')21seed_5 = np.array(file['success_rate'])22# print(seed_5)23success_rate_02_future = []24success_rate_02_future.append(seed_1)25success_rate_02_future.append(seed_2)26success_rate_02_future.append(seed_3)27success_rate_02_future.append(seed_4)28success_rate_02_future.append(seed_5)29success_rate_02_future = np.array(success_rate_02_future)30# we have to load all the performance31path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_1"32file = h5py.File(path, 'r')33seed_1 = np.array(file['success_rate'])34path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_42"35file = h5py.File(path, 'r')36seed_2 = np.array(file['success_rate'])37path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_213"38file = h5py.File(path, 'r')39seed_3 = np.array(file['success_rate'])40path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_666"41file = h5py.File(path, 'r')42seed_4 = np.array(file['success_rate'])43path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_777"44file = h5py.File(path, 'r')45seed_5 = np.array(file['success_rate'])46# print(seed_5)47success_rate_07_Future = []48success_rate_07_Future.append(seed_1)49success_rate_07_Future.append(seed_2)50success_rate_07_Future.append(seed_3)51success_rate_07_Future.append(seed_4)52success_rate_07_Future.append(seed_5)53success_rate_07_Future = np.array(success_rate_07_Future)54# we have to load all the performance55path = "../HER/performance_up/reach_seed_up_UP_more_exploration_02_all_epochs_final_strategy_seed_1"56file = h5py.File(path, 'r')57seed_1 = np.array(file['success_rate'])58path = "../HER/performance_up/reach_seed_up_UP_more_exploration_02_all_epochs_final_strategy_seed_42"59file = h5py.File(path, 'r')60seed_2 = np.array(file['success_rate'])61path = "../HER/performance_up/reach_seed_up_UP_more_exploration_02_all_epochs_final_strategy_seed_213"62file = h5py.File(path, 'r')63seed_3 = np.array(file['success_rate'])64path = "../HER/performance_up/reach_seed_up_UP_more_exploration_02_all_epochs_final_strategy_seed_666"65file = h5py.File(path, 'r')66seed_4 = np.array(file['success_rate'])67path = "../HER/performance_up/reach_seed_up_UP_more_exploration_02_all_epochs_final_strategy_seed_777"68file = h5py.File(path, 'r')69seed_5 = np.array(file['success_rate'])70# print(seed_5)71success_rate_02_final = []72success_rate_02_final.append(seed_1)73success_rate_02_final.append(seed_2)74success_rate_02_final.append(seed_3)75success_rate_02_final.append(seed_4)76success_rate_02_final.append(seed_5)77success_rate_02_final = np.array(success_rate_02_final)78# we have to load all the performance79path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_final_strategy_seed_1"80file = h5py.File(path, 'r')81seed_1 = np.array(file['success_rate'])82path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_final_strategy_seed_42"83file = h5py.File(path, 'r')84seed_2 = np.array(file['success_rate'])85path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_final_strategy_seed_213"86file = h5py.File(path, 'r')87seed_3 = np.array(file['success_rate'])88path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_final_strategy_seed_666"89file = h5py.File(path, 'r')90seed_4 = np.array(file['success_rate'])91path = "../HER/performance_up/reach_seed_up_UP_more_exploration_07_for_third_of_epochs_final_strategy_seed_777"92file = h5py.File(path, 'r')93seed_5 = np.array(file['success_rate'])94# print(seed_5)95success_rate_07_final = []96success_rate_07_final.append(seed_1)97success_rate_07_final.append(seed_2)98success_rate_07_final.append(seed_3)99success_rate_07_final.append(seed_4)100success_rate_07_final.append(seed_5)101success_rate_07_final = np.array(success_rate_07_final)102index = [i for i in range(len(seed_1))]103# print(index)104f, ax = plt.subplots()105# ax = plt.gca()106# update_one_plot(ax, "#0072BD", 'epsilon = 0.2, strategy = Future', index, success_rate_02_future, 'median')107# update_one_plot(ax, "#D95319", 'epsilon = 0.7 for 1/3 epochs, strategy = Future', index, success_rate_07_Future, 'median')108update_one_plot(ax, "#7E2F8E", 'epsilon = 0.2, strategy = Final', index, success_rate_02_final, 'median')109update_one_plot(ax, "#006450", 'epsilon = 0.7 for 1/3 epochs, strategy = Final', index, success_rate_07_final, 'median')110# update_one_plot(ax, "#7E2F8E", 'Path heuristic', index, np.transpose(explored_path), 'median')111# update_one_plot(ax, "#EDB120", 'Path heuristic more accurate', index, np.transpose(explored_path_mc), 'median')112plt.xticks(np.arange(0,index[-1]+2,step=50))113plt.ylabel('Success Rate')114plt.xlabel('Epochs')115plt.title('Success rate of the policy trained in the task space upper half ')116plt.legend(loc='lower right')117plt.grid()118plt.show()119f.savefig("upper_policy_07vs02_final.pdf")...

Full Screen

Full Screen

firebase.js

Source:firebase.js Github

copy

Full Screen

1var exec = require('cordova/exec');2exports.getVerificationID = function (number, success, error) {3 exec(success, error, "FirebasePlugin", "getVerificationID", [number]);4};5exports.getInstanceId = function (success, error) {6 exec(success, error, "FirebasePlugin", "getInstanceId", []);7};8exports.getId = function (success, error) {9 exec(success, error, "FirebasePlugin", "getId", []);10};11exports.getToken = function (success, error) {12 exec(success, error, "FirebasePlugin", "getToken", []);13};14exports.onNotificationOpen = function (success, error) {15 exec(success, error, "FirebasePlugin", "onNotificationOpen", []);16};17exports.onTokenRefresh = function (success, error) {18 exec(success, error, "FirebasePlugin", "onTokenRefresh", []);19};20exports.grantPermission = function (success, error) {21 exec(success, error, "FirebasePlugin", "grantPermission", []);22};23exports.hasPermission = function (success, error) {24 exec(success, error, "FirebasePlugin", "hasPermission", []);25};26exports.setBadgeNumber = function (number, success, error) {27 exec(success, error, "FirebasePlugin", "setBadgeNumber", [number]);28};29exports.getBadgeNumber = function (success, error) {30 exec(success, error, "FirebasePlugin", "getBadgeNumber", []);31};32exports.subscribe = function (topic, success, error) {33 exec(success, error, "FirebasePlugin", "subscribe", [topic]);34};35exports.unsubscribe = function (topic, success, error) {36 exec(success, error, "FirebasePlugin", "unsubscribe", [topic]);37};38exports.unregister = function (success, error) {39 exec(success, error, "FirebasePlugin", "unregister", []);40};41exports.logEvent = function (name, params, success, error) {42 exec(success, error, "FirebasePlugin", "logEvent", [name, params]);43};44// @Deprecated. Use "logJSError" method instead45exports.logError = function (message, success, error) {46 exec(success, error, "FirebasePlugin", "logError", [message]);47};48exports.logJSError = function (message, stackTrace, success, error) {49 var args = [message];50 // "stackTrace" is an optional arg that's an array of objects.51 if (stackTrace) {52 args.push(stackTrace);53 }54 exec(success, error, "FirebasePlugin", "logError", args);55};56exports.setCrashlyticsUserId = function (userId, success, error) {57 exec(success, error, "FirebasePlugin", "setCrashlyticsUserId", [userId]);58};59exports.setScreenName = function (name, success, error) {60 exec(success, error, "FirebasePlugin", "setScreenName", [name]);61};62exports.setUserId = function (id, success, error) {63 exec(success, error, "FirebasePlugin", "setUserId", [id]);64};65exports.setUserProperty = function (name, value, success, error) {66 exec(success, error, "FirebasePlugin", "setUserProperty", [name, value]);67};68exports.activateFetched = function (success, error) {69 exec(success, error, "FirebasePlugin", "activateFetched", []);70};71exports.fetch = function (cacheExpirationSeconds, success, error) {72 var args = [];73 if (typeof cacheExpirationSeconds === 'number') {74 args.push(cacheExpirationSeconds);75 } else {76 error = success;77 success = cacheExpirationSeconds;78 }79 exec(success, error, "FirebasePlugin", "fetch", args);80};81exports.getByteArray = function (key, success, error) {82 exec(success, error, "FirebasePlugin", "getByteArray", [key]);83};84exports.getValue = function (key, success, error) {85 exec(success, error, "FirebasePlugin", "getValue", [key]);86};87exports.getInfo = function (success, error) {88 exec(success, error, "FirebasePlugin", "getInfo", []);89};90exports.setConfigSettings = function (settings, success, error) {91 exec(success, error, "FirebasePlugin", "setConfigSettings", [settings]);92};93exports.setDefaults = function (defaults, success, error) {94 exec(success, error, "FirebasePlugin", "setDefaults", [defaults]);95};96exports.startTrace = function (name, success, error) {97 exec(success, error, "FirebasePlugin", "startTrace", [name]);98};99exports.incrementCounter = function (name, counterNamed, success, error) {100 exec(success, error, "FirebasePlugin", "incrementCounter", [name, counterNamed]);101};102exports.stopTrace = function (name, success, error) {103 exec(success, error, "FirebasePlugin", "stopTrace", [name]);104};105exports.setAnalyticsCollectionEnabled = function (enabled, success, error) {106 exec(success, error, "FirebasePlugin", "setAnalyticsCollectionEnabled", [enabled]);107};108exports.setPerformanceCollectionEnabled = function (enabled, success, error) {109 exec(success, error, "FirebasePlugin", "setPerformanceCollectionEnabled", [enabled]);110};111exports.verifyPhoneNumber = function (number, timeOutDuration, success, error) {112 if (typeof timeOutDuration === 'function') {113 // method being called with old signature: function(number, success, error)114 // timeOutDuration is the success callback, success is the error callback115 exec(timeOutDuration, success, "FirebasePlugin", "verifyPhoneNumber", [number]);116 } else {117 // method being called with new signature: function(number, timeOutDuration, success, error)118 // callbacks are correctly named119 exec(success, error, "FirebasePlugin", "verifyPhoneNumber", [number, timeOutDuration]);120 }121};122exports.clearAllNotifications = function (success, error) {123 exec(success, error, "FirebasePlugin", "clearAllNotifications", []);124};125// For Android O only126exports.createChannel = function (success, error, channel) {127 exec(success, error, 'FirebasePlugin', 'createChannel', [channel]);...

Full Screen

Full Screen

firebase-browser.js

Source:firebase-browser.js Github

copy

Full Screen

1exports.getVerificationID = function (number, success, error) {2 if (typeof success === 'function') {3 success();4 }5};6exports.getInstanceId = function (success, error) {7 if (typeof success === 'function') {8 success();9 }10};11exports.getToken = function (success, error) {12 if (typeof success === 'function') {13 success();14 }15};16exports.getId = function (success, error) {17 if (typeof success === 'function') {18 success();19 }20};21exports.onNotificationOpen = function (success, error) {22};23exports.onTokenRefresh = function (success, error) {24};25exports.grantPermission = function (success, error) {26 if (typeof success === 'function') {27 success();28 }29};30exports.setBadgeNumber = function (number, success, error) {31 if (typeof success === 'function') {32 success();33 }34};35exports.getBadgeNumber = function (success, error) {36 if (typeof success === 'function') {37 success();38 }39};40exports.subscribe = function (topic, success, error) {41 if (typeof success === 'function') {42 success();43 }44};45exports.unsubscribe = function (topic, success, error) {46 if (typeof success === 'function') {47 success();48 }49};50exports.logEvent = function (name, params, success, error) {51 if (typeof success === 'function') {52 success();53 }54};55xports.logError = function (message, success, error) {56 if (typeof success === 'function') {57 success();58 }59};60exports.logJSError = function (message, stackTrace, success, error) {61 if (typeof success === 'function') {62 success();63 }64};65exports.setCrashlyticsUserId = function (userId, success, error) {66 if (typeof success === 'function') {67 success();68 }69};70exports.setScreenName = function (name, success, error) {71 if (typeof success === 'function') {72 success();73 }74};75exports.setUserId = function (id, success, error) {76 if (typeof success === 'function') {77 success();78 }79};80exports.setUserProperty = function (name, value, success, error) {81 if (typeof success === 'function') {82 success();83 }84};85exports.activateFetched = function (success, error) {86 if (typeof success === 'function') {87 success();88 }89};90exports.fetch = function (cacheExpirationSeconds, success, error) {91 if (typeof success === 'function') {92 success();93 }94};95exports.getByteArray = function (key, success, error) {96 if (typeof success === 'function') {97 success();98 }99};100exports.getValue = function (key, success, error) {101 if (typeof success === 'function') {102 success();103 }104};105exports.getInfo = function (success, error) {106 if (typeof success === 'function') {107 success();108 }109};110exports.setConfigSettings = function (settings, success, error) {111 if (typeof success === 'function') {112 success();113 }114};115exports.setDefaults = function (defaults, success, error) {116 if (typeof success === 'function') {117 success();118 }119};120exports.verifyPhoneNumber = function (number, timeOutDuration, success, error) {121 if (typeof success === 'function') {122 success();123 }124};125exports.setAnalyticsCollectionEnabled = function (enabled, success, error) {126 if (typeof success === 'function') {127 success();128 }129};130exports.setPerformanceCollectionEnabled = function (enabled, success, error) {131 if (typeof success === 'function') {132 success();133 }134};135exports.clearAllNotifications = function (success, error) {136 if (typeof success === 'function') {137 success();138 }...

Full Screen

Full Screen

test_serial.py

Source:test_serial.py Github

copy

Full Screen

1import unittest2import sshim3from . import connect4def success(script):5 script.writeline('success')6class TestMultipleServers(unittest.TestCase):7 def assert_success(self, server):8 with connect(server) as fileobj:9 self.assertEqual(fileobj.readline(), 'success\r\n')10 def test_one_after_another_reuse(self):11 with sshim.Server(success, address='127.0.0.1', port=3000) as server:12 self.assert_success(server)13 with sshim.Server(success, address='127.0.0.1', port=3000) as server:14 self.assert_success(server)15 def test_another_server_reuse(self):16 with sshim.Server(success, address='127.0.0.1', port=3000) as server:17 self.assert_success(server)18 def test_one_after_another_different(self):19 with sshim.Server(success, address='127.0.0.1', port=0) as server:20 self.assert_success(server)21 with sshim.Server(success, address='127.0.0.1', port=0) as server:22 self.assert_success(server)23 def test_another_server_different(self):24 with sshim.Server(success, address='127.0.0.1', port=0) as server:...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2fc.assert(3 fc.property(fc.integer(), fc.integer(), (a, b) => {4 return a + b >= a;5 })6);7const fc = require('fast-check');8fc.assert(9 fc.property(fc.integer(), fc.integer(), (a, b) => {10 return a + b >= a;11 })12);13const fc = require('fast-check');14fc.assert(15 fc.property(fc.integer(), fc.integer(), (a, b) => {16 return a + b >= a;17 })18);19const fc = require('fast-check');20fc.assert(21 fc.property(fc.integer(), fc.integer(), (a, b) => {22 return a + b >= a;23 })24);25const fc = require('fast-check');26fc.assert(27 fc.property(fc.integer(), fc.integer(), (a, b) => {28 return a + b >= a;29 })30);31const fc = require('fast-check');32fc.assert(33 fc.property(fc.integer(), fc.integer(), (a, b) => {34 return a + b >= a;35 })36);37const fc = require('fast-check');38fc.assert(39 fc.property(fc.integer(), fc.integer(), (a, b) => {40 return a + b >= a;41 })42);43const fc = require('fast-check');44fc.assert(45 fc.property(fc.integer(), fc.integer(), (a, b) => {46 return a + b >= a;47 })48);49const fc = require('fast-check');50fc.assert(51 fc.property(fc.integer(), fc.integer(), (a, b) => {

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2fc.assert(3 fc.property(fc.nat(), fc.nat(), fc.nat(), (a, b, c) => {4 return a + b + c >= a;5 })6);7const fc = require('fast-check');8fc.assert(9 fc.property(fc.nat(), fc.nat(), fc.nat(), (a, b, c) => {10 return a + b + c >= a;11 })12);13const fc = require('fast-check');14fc.assert(15 fc.property(fc.nat(), fc.nat(), fc.nat(), (a, b, c) => {16 return a + b + c >= a;17 })18);19const fc = require('fast-check');20fc.assert(21 fc.property(fc.nat(), fc.nat(), fc.nat(), (a, b, c) => {22 return a + b + c >= a;23 })24);25const fc = require('fast-check');26fc.assert(27 fc.property(fc.nat(), fc.nat(), fc.nat(), (a, b, c) => {28 return a + b + c >= a;29 })30);31const fc = require('fast-check');32fc.assert(33 fc.property(fc.nat(), fc.nat(), fc.nat(), (a, b, c) => {34 return a + b + c >= a;35 })36);37const fc = require('fast-check');38fc.assert(39 fc.property(fc.nat(), fc.nat(), fc.nat(), (a, b, c) => {40 return a + b + c >= a;41 })42);43const fc = require('fast-check');44fc.assert(45 fc.property(fc.nat(), fc.nat(),

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2fc.assert(3 fc.property(fc.integer(), fc.integer(), (a, b) => {4 return a + b === b + a;5 })6);7const fc = require('fast-check');8fc.assert(9 fc.property(fc.integer(), fc.integer(), (a, b) => {10 return a + b === b + a;11 })12);13const fc = require('fast-check');14fc.assert(15 fc.property(fc.integer(), fc.integer(), (a, b) => {16 return a + b === b + a;17 })18);19const fc = require('fast-check');20fc.assert(21 fc.property(fc.integer(), fc.integer(), (a, b) => {22 return a + b === b + a;23 })24);25const fc = require('fast-check');26fc.assert(27 fc.property(fc.integer(), fc.integer(), (a, b) => {28 return a + b === b + a;29 })30);31const fc = require('fast-check');32fc.assert(33 fc.property(fc.integer(), fc.integer(), (a, b) => {34 return a + b === b + a;35 })36);37const fc = require('fast-check');38fc.assert(39 fc.property(fc.integer(), fc.integer(), (a, b) => {40 return a + b === b + a;41 })42);43const fc = require('fast-check');44fc.assert(45 fc.property(fc.integer(), fc.integer(), (a, b) => {46 return a + b === b + a;47 })48);49const fc = require('fast-check');50fc.assert(51 fc.property(fc.integer(), fc

Full Screen

Using AI Code Generation

copy

Full Screen

1const { success } = require('fast-check-monorepo');2success();3const { success } = require('fast-check');4success();5const { success } = require('fast-check-monorepo');6success();7const { success } = require('fast-check');8success();9const { success } = require('fast-check-monorepo');10success();11const { success } = require('fast-check');12success();13const { success } = require('fast-check-monorepo');14success();15const { success } = require('fast-check');16success();17const { success } = require('fast-check-monorepo');18success();19const { success } = require('fast-check');20success();21const { success } = require('fast-check-monorepo');22success();23const { success } = require('fast-check');24success();25const { success } = require('fast-check-monorepo');26success();27const { success } = require('fast-check');28success();29const { success } = require('fast-check-monorepo');30success();31const { success } = require('fast-check');32success();33const { success } = require('fast-check-monorepo');34success();35const { success } = require('fast-check');36success();

Full Screen

Using AI Code Generation

copy

Full Screen

1const fc = require('fast-check');2fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));3fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= b));4const fc = require('fast-check');5fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));6fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= b));7const fc = require('fast-check');8fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));9fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= b));10const fc = require('fast-check');11fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));12fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= b));13const fc = require('fast-check');14fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));15fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= b));16const fc = require('fast-check');17fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= a));18fc.assert(fc.property(fc.integer(), fc.integer(), (a, b) => a + b >= b));

Full Screen

Using AI Code Generation

copy

Full Screen

1const { success } = require('fast-check');2success();3const { success } = require('fast-check');4success();5at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)6at Function.Module._load (internal/modules/cjs/loader.js:562:25)7at Module.require (internal/modules/cjs/loader.js:692:17)8at require (internal/modules/cjs/helpers.js:25:18)9at Object. (C:\Users\abc\Documents\abc\test4.js:2:17)10at Module._compile (internal/modules/cjs/loader.js:778:30)11at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)12at Module.load (internal/modules/cjs/loader.js:653:32)13at tryModuleLoad (internal/modules/cjs/loader.js:593:12)14at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run fast-check-monorepo automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful