Best Python code snippet using freezegun
mouse-helper.js
Source:mouse-helper.js
1/* global jQuery:false */2(function() {3 "use strict";4 var requestAnimationFrame = window.requestAnimationFrame5 || window.webkitRequestAnimationFrame6 || window.mozRequestAnimationFrame7 || window.oRequestAnimationFrame8 || window.msRequestAnimationFrame9 || null;10 var mouseX = null, mouseY = null,11 realX = null, realY = null,12 destX = 0, destY = 0;13 var mouse_helper_timeout = 0,14 mouse_helper_target = null,15 mouse_helper_last_target = null,16 mouse_helper_action = '',17 mouse_helper_last_action = '',18 mouse_helper_blend_mode = '',19 mouse_helper_color = '',20 mouse_helper_bg_color = '',21 mouse_helper_bd_color = '',22 mouse_helper_callback = '',23 mouse_helper_axis = 'xy',24 mouse_helper_delay = 1;25 var $window = jQuery( window ),26 _window_height = $window.height(),27 _window_width = $window.width(),28 _window_scroll_top = $window.scrollTop(),29 _window_scroll_left = $window.scrollLeft(),30 $document = jQuery( document ),31 $body = jQuery( 'body' ),32 $mouse_helper = jQuery('.trx_addons_mouse_helper');33 var $mouse_helper_targets,34 $mouse_helper_magnets;35 // Update links and values after the new post added36 $document.on( 'action.got_ajax_response', update_jquery_links );37 $document.on( 'action.init_hidden_elements', update_jquery_links );38 var first_run = true;39 function update_jquery_links(e) {40 if ( first_run && e && e.namespace == 'init_hidden_elements' ) {41 first_run = false;42 return; 43 }44 $mouse_helper_targets = jQuery('[data-mouse-helper]');45 $mouse_helper_magnets = jQuery('[data-mouse-helper-magnet]:not([data-mouse-helper-magnet="0"])');46 }47 update_jquery_links();48 // Update global values49 $document.on( 'action.scroll_trx_addons', function() {50 _window_scroll_top = $window.scrollTop();51 } );52 $document.on( 'action.resize_trx_addons', function() {53 _window_height = $window.height();54 _window_width = $window.width();55 _window_scroll_top = $window.scrollTop();56 _window_scroll_left = $window.scrollLeft();57 } );58 // Init Mouse helper59 $document.on('action.init_trx_addons', function() {60 if ( TRX_ADDONS_STORAGE['mouse_helper'] > 0 && $mouse_helper.length > 0 && requestAnimationFrame ) {61 mouse_helper_blend_mode = $mouse_helper.css( 'mix-blend-mode' );62 mouse_helper_color = $mouse_helper.css( 'color' );63 mouse_helper_bg_color = $mouse_helper.css( 'background-color' );64 mouse_helper_bd_color = $mouse_helper.css( 'border-color' );65 mouse_helper_delay = TRX_ADDONS_STORAGE['mouse_helper_delay'];66 $document67 .on( 'mousemove', function(e) {68 trx_addons_mouse_helper_get_state(e);69 if ( mouse_helper_callback && typeof window[mouse_helper_callback] == 'function' ) {70 window[mouse_helper_callback]( 'mousemove', $mouse_helper, mouse_helper_target, e );71 } else if ( typeof window['trx_addons_mouse_helper_callback_' + mouse_helper_action] == 'function' ) {72 window['trx_addons_mouse_helper_callback_' + mouse_helper_action]( 'mousemove', $mouse_helper, mouse_helper_target, e );73 }74 if ( mouse_helper_action == 'highlight' && mouse_helper_target ) {75 var targetOffset = mouse_helper_target.offset(),76 targetX = targetOffset.left - _window_scroll_left,77 targetY = targetOffset.top - _window_scroll_top,78 size = parseFloat(mouse_helper_target.css('background-size').split(' ')[0])/2;79 mouse_helper_target.css('background-position', (mouseX-targetX-size)+'px '+(mouseY-targetY-size)+'px');80 }81 if ( _window_width >= TRX_ADDONS_STORAGE['mobile_breakpoint_mousehelper_off'] ) {82 if ( mouse_helper_delay < 2 ) {83 destX = mouseX;84 destY = mouseY;85 $mouse_helper.css("transform", "translate(" + destX + "px," + destY + "px)");86 }87 if ( mouseX > _window_width - 100 ) {88 if ( ! $mouse_helper.hasClass( 'trx_addons_mouse_helper_left' ) ) {89 $mouse_helper.addClass( 'trx_addons_mouse_helper_left' );90 }91 } else {92 if ( $mouse_helper.hasClass( 'trx_addons_mouse_helper_left' ) ) {93 $mouse_helper.removeClass( 'trx_addons_mouse_helper_left' );94 }95 }96 if ( mouseY > _window_height - 100 ) {97 if ( ! $mouse_helper.hasClass( 'trx_addons_mouse_helper_top' ) ) {98 $mouse_helper.addClass( 'trx_addons_mouse_helper_top' );99 }100 } else {101 if ( $mouse_helper.hasClass( 'trx_addons_mouse_helper_top' ) ) {102 $mouse_helper.removeClass( 'trx_addons_mouse_helper_top' );103 }104 }105 // Check magnets106 trx_addons_mouse_helper_check_magnets();107 }108 } )109 .on("mouseenter", '[data-mouse-helper]', function(e) {110 var $self = jQuery(this).addClass('trx_addons_mouse_helper_over');111 mouse_helper_target = mouse_helper_last_target = $self;112 mouse_helper_action = mouse_helper_last_action = $self.data( 'mouse-helper' );113 if ( _window_width >= TRX_ADDONS_STORAGE['mobile_breakpoint_mousehelper_off'] ) {114 mouse_helper_reset();115 if ( mouse_helper_timeout ) {116 clearTimeout( mouse_helper_timeout );117 mouse_helper_timeout = 0;118 }119 }120 mouse_helper_callback = $self.data( 'mouse-helper-callback' );121 if ( mouse_helper_callback === undefined ) {122 mouse_helper_callback = '';123 }124 if ( mouse_helper_callback && typeof window[mouse_helper_callback] == 'function' ) {125 window[mouse_helper_callback]( 'mouseenter', $mouse_helper, $self, e );126 } else if ( typeof window['trx_addons_mouse_helper_callback_' + mouse_helper_action] == 'function' ) {127 window['trx_addons_mouse_helper_callback_' + mouse_helper_action]( 'mouseenter', $mouse_helper, $self, e );128 }129 mouse_helper_axis = $self.data( 'mouse-helper-axis' );130 if ( mouse_helper_axis === undefined ) {131 mouse_helper_axis = 'xy';132 }133 mouse_helper_delay = $self.data( 'mouse-helper-delay' );134 if ( mouse_helper_delay === undefined ) {135 mouse_helper_delay = TRX_ADDONS_STORAGE['mouse_helper_delay'];136 }137 138 trx_addons_mouse_helper_get_state(e);139 if ( _window_width >= TRX_ADDONS_STORAGE['mobile_breakpoint_mousehelper_off'] ) {140 // Centered141 var pos = TRX_ADDONS_STORAGE['mouse_helper_centered'] > 0 || $self.data("mouse-helper-centered") > 0 || '';142 if ( pos > 0 ) {143 $mouse_helper144 .addClass( 'trx_addons_mouse_helper_centered' );145 }146 // Overlay mode147 var mode = $self.data("mouse-helper-mode") || '';148 if ( mode ) {149 $mouse_helper.css( 'mix-blend-mode', mode );150 }151 // Text color152 var color = $self.data("mouse-helper-color") || '';153 if ( color ) {154 $mouse_helper.css( 'color', color );155 }156 // Background color157 var bg_color = $self.data("mouse-helper-bg-color") || '';158 if ( bg_color ) {159 $mouse_helper.css( 'background-color', bg_color );160 }161 // Border color162 var bd_color = $self.data("mouse-helper-bd-color") || '';163 if ( bd_color ) {164 $mouse_helper.css( 'border-color', bd_color );165 }166 // Add image167 var img = $self.data("mouse-helper-image") || '';168 if ( img ) {169 $mouse_helper170 .find('.trx_addons_mouse_helper_image').remove().end()171 .append( '<span class="trx_addons_mouse_helper_image" style="background-image:url(' + img + ');"></span>' )172 .addClass( "trx_addons_mouse_helper_with_image");173 }174 // Add icon175 var icon = $self.data("mouse-helper-icon") || '';176 if ( icon ) {177 var icon_color = $self.data("mouse-helper-icon-color") || '',178 icon_size = $self.data("mouse-helper-icon-size") || '';179 $mouse_helper180 .find('.trx_addons_mouse_helper_icon').remove().end()181 .append( '<span class="trx_addons_mouse_helper_icon ' + icon + '"'182 + ' style="'183 + ( icon_color ? 'color: ' + icon_color + ';' : '' )184 + ( icon_size ? 'font-size: ' + icon_size + 'em;' : '' )185 + '"'186 +'></span>' )187 .addClass( 'trx_addons_mouse_helper_with_icon' );188 }189 // Add text190 var text = $self.data("mouse-helper-text") || '',191 text_round = $self.data("mouse-helper-text-round") > 0 || false,192 text_size = $self.data("mouse-helper-text-size") || '';193 if ( text ) {194 $mouse_helper195 .find('.trx_addons_mouse_helper_text').remove().end()196 .append( '<span class="trx_addons_mouse_helper_text' + ( text_round ? ' trx_addons_mouse_helper_text_round' : '' ) + '"'197 + ( text_size ? ' style="font-size:' + text_size + 'em;"' : '' )198 + '>'199 + ( text_round ? trx_addons_wrap_chars( text, '<span class="trx_addons_mouse_helper_text_round_item">', '</span>' ) : text )200 + '</span>' )201 .addClass( 'trx_addons_mouse_helper_with_text' + ( text_round ? ' trx_addons_mouse_helper_with_text_round' : '' ) );202 if ( text_round ) {203 var rtl = $body.hasClass( 'rtl' );204 setTimeout( function() {205 var text_wrap = $mouse_helper.find( '.trx_addons_mouse_helper_text' ),206 items = text_wrap.find( '.trx_addons_mouse_helper_text_round_item' );207 if ( items.length > 0) {208 var r = Math.ceil( text_wrap.width() / 2 ),209 a = 0,210 hide = false;211 items.each( function( idx ) {212 if ( hide ) {213 items.eq( idx ).hide();214 } else {215 if ( a >= ( rtl ? 310 : 330 ) ) { // If fill whole round - hide rest chars and replace its with '...'216 items.eq( idx ).html('…');217 hide = true;218 }219 var x = r + r * Math.sin( a / 180 * Math.PI ),220 y = r - r * Math.cos( a / 180 * Math.PI ),221 css = {222 'transform': 'rotate(' + ( rtl ? -a : a ) + 'deg)',223 'top': y + 'px'224 };225 if ( rtl ) {226 css.right = x + 'px';227 } else {228 css.left = x + 'px';229 }230 items.eq( idx ).css( css );231 a += 2 * Math.asin( ( items.eq( idx ).width() + ( rtl ? 3 : 3 ) ) / ( 2 * r ) ) * 180 / Math.PI;232 }233 } );234 }235 }, 350);236 }237 }238 // Add custom HTML code239 var layout = $self.data("mouse-helper-layout") || '';240 if ( layout ) {241 $mouse_helper242 .find('.trx_addons_mouse_helper_layout').remove().end()243 .append( '<span class="trx_addons_mouse_helper_layout">' + layout + '</span>' )244 .addClass( 'trx_addons_mouse_helper_with_layout' );245 }246 // Set 'active' and 'action' classes247 $mouse_helper.addClass( "trx_addons_mouse_helper_active trx_addons_mouse_helper_action_" + mouse_helper_action);248 }249 } )250 .on("mouseleave", '[data-mouse-helper]', function(e) {251 if ( mouse_helper_callback && typeof window[mouse_helper_callback] == 'function' ) {252 window[mouse_helper_callback]( 'mouseleave', $mouse_helper, mouse_helper_target, e );253 mouse_helper_callback = '';254 } else if ( typeof window['trx_addons_mouse_helper_callback_' + mouse_helper_action] == 'function' ) {255 window['trx_addons_mouse_helper_callback_' + mouse_helper_action]( 'mouseleave', $mouse_helper, mouse_helper_target, e );256 }257 $mouse_helper.removeClass( 'trx_addons_mouse_helper_click'258 + ' trx_addons_mouse_helper_action_' + mouse_helper_action259 );260 if ( mouse_helper_target ) {261 mouse_helper_target.removeClass('trx_addons_mouse_helper_over');262 }263 mouse_helper_target = null;264 mouse_helper_action = '';265 mouse_helper_axis = 'xy';266 mouse_helper_delay = TRX_ADDONS_STORAGE['mouse_helper_delay'];267 if ( _window_width >= TRX_ADDONS_STORAGE['mobile_breakpoint_mousehelper_off'] ) {268 mouse_helper_timeout = setTimeout( function() {269 mouse_helper_reset();270 }, 300 );271 }272 if ( e.relatedTarget ) {273 var newTarget = jQuery(e.relatedTarget);274 if ( ! newTarget.data('mouse-helper') ) {275 newTarget = newTarget.parents('[data-mouse-helper]').eq(0);276 }277 if ( newTarget.length > 0 && newTarget.data('mouse-helper') ) {278 setTimeout( function() {279 newTarget.trigger('mouseenter');280 }, 0 );281 }282 }283 } )284 .on("mousedown", '[data-mouse-helper]', function(e) {285 var $self = jQuery(this);286 $mouse_helper.addClass('trx_addons_mouse_helper_click');287 mouse_helper_callback = $self.data( 'mouse-helper-callback' );288 if ( mouse_helper_callback === undefined ) {289 mouse_helper_callback = '';290 }291 if ( mouse_helper_callback && typeof window[mouse_helper_callback] == 'function' ) {292 window[mouse_helper_callback]( 'mousedown', $mouse_helper, $self, e );293 } else if ( typeof window['trx_addons_mouse_helper_callback_' + mouse_helper_action] == 'function' ) {294 window['trx_addons_mouse_helper_callback_' + mouse_helper_action]( 'mousedown', $mouse_helper, $self, e );295 }296 } )297 .on("mouseup", '[data-mouse-helper]', function(e) {298 var $self = jQuery(this);299 $mouse_helper.removeClass('trx_addons_mouse_helper_click');300 mouse_helper_callback = $self.data( 'mouse-helper-callback' );301 if ( mouse_helper_callback === undefined ) {302 mouse_helper_callback = '';303 }304 if ( mouse_helper_callback && typeof window[mouse_helper_callback] == 'function' ) {305 window[mouse_helper_callback]( 'mouseup', $mouse_helper, $self, e );306 } else if ( typeof window['trx_addons_mouse_helper_callback_' + mouse_helper_action] == 'function' ) {307 window['trx_addons_mouse_helper_callback_' + mouse_helper_action]( 'mouseup', $mouse_helper, $self, e );308 }309 } );310 var mouse_helper_reset = function() {311 $mouse_helper312 .find('.trx_addons_mouse_helper_image,.trx_addons_mouse_helper_text,.trx_addons_mouse_helper_icon,.trx_addons_mouse_helper_layout')313 .addClass('trx_addons_mouse_helper_reset_item')314 .fadeOut('slow', function() {315 var $self = jQuery(this);316 if ( $self.hasClass('trx_addons_mouse_helper_reset_item') ) {317 $self.remove();318 }319 });320 $mouse_helper321 .css( {322 'mix-blend-mode': mouse_helper_blend_mode,323 'color': mouse_helper_color,324 'background-color': mouse_helper_bg_color,325 'border-color': mouse_helper_bd_color326 } )327 .removeClass(328 "trx_addons_mouse_helper_active"329 + " trx_addons_mouse_helper_with_icon"330 + " trx_addons_mouse_helper_with_text"331 + " trx_addons_mouse_helper_text_round"332 + " trx_addons_mouse_helper_with_image"333 + " trx_addons_mouse_helper_with_layout"334 + ( TRX_ADDONS_STORAGE['mouse_helper_centered'] > 0 ? "" : " trx_addons_mouse_helper_centered" )335 );336 if ( mouse_helper_callback && typeof window[mouse_helper_callback] == 'function' ) {337 window[mouse_helper_callback]( 'reset', $mouse_helper, mouse_helper_last_target, null );338 mouse_helper_callback = '';339 } else if ( typeof window['trx_addons_mouse_helper_callback_' + mouse_helper_last_action] == 'function' ) {340 window['trx_addons_mouse_helper_callback_' + mouse_helper_last_action]( 'reset', $mouse_helper, mouse_helper_last_target, e );341 }342 };343 var mouse_helper_move = function() {344 cancelAnimationFrame(mouse_helper_move);345 if ( _window_width >= TRX_ADDONS_STORAGE['mobile_breakpoint_mousehelper_off'] && null !== mouseX && ( destX != mouseX || destY != mouseY ) && mouse_helper_delay > 1 ) {346 if ( $mouse_helper.hasClass( 'trx_addons_mouse_helper_permanent' ) || $mouse_helper.hasClass( 'trx_addons_mouse_helper_active' ) ) {347 destX += (mouseX - destX) / mouse_helper_delay;348 destY += (mouseY - destY) / mouse_helper_delay;349 } else {350 destX = mouseX;351 destY = mouseY;352 }353 $mouse_helper.css("transform", "translate(" + destX + "px," + destY + "px)");354 }355 requestAnimationFrame(mouse_helper_move);356 };357 requestAnimationFrame(mouse_helper_move);358 // Get current state359 function trx_addons_mouse_helper_get_state(e) {360 if ( e.clientX === undefined ) return;361 realX = e.clientX + _window_scroll_left;362 realY = e.clientY + _window_scroll_top;363 if ( mouse_helper_axis.indexOf('x') != -1 ) mouseX = e.clientX;364 if ( mouse_helper_axis.indexOf('y') != -1 ) mouseY = e.clientY;365 }366 // Check magnets367 function trx_addons_mouse_helper_check_magnets() {368 $mouse_helper_magnets.each( function() {369 var item = jQuery(this),370 inner = item.children(),371 koef = item.data('mouse-helper-magnet-velocity') ? item.data('mouse-helper-magnet-velocity') : 1,372 delta = item.data('mouse-helper-magnet') * koef;373 var data, cx, cy, iw, ih, ix, iy, near; //position variables374 requestAnimationFrame(control_item);375 function control_item() {376 var off = item.offset();377 cx = realX;378 cy = realY;379 iw = item.width();380 ih = item.height();381 ix = off.left + iw / 2;382 iy = off.top + ih / 2;383 near = Math.abs(ix - cx) < iw * koef && Math.abs(iy - cy) < ih * koef;384 if (near) {385 ! item.hasClass('trx_addons_mouse_helper_near') && move_item();386 requestAnimationFrame(control_item);387 } else {388 item.hasClass('trx_addons_mouse_helper_near') && reset_item();389 }390 }391 function move_item() {392 item.addClass('trx_addons_mouse_helper_near');393 var d = get_closest_position(),394 dx = d.x,395 dy = d.y,396 nx = 0,397 ny = 0;398 transform_item();399 function transform_item() {400 var d = get_closest_position();401 nx += (d.x - dx) / 5;402 ny += (d.y - dy) / 5;403 nx.toFixed(2) !== dx.toFixed(2) &&404 inner.css({405 'transition': 'none',406 'transform': 'translate3d(' + nx + 'px, ' + ny + 'px, 0)'407 });408 dx = nx;409 dy = ny;410 requestAnimationFrame(function () {411 near && transform_item();412 });413 }414 function get_closest_position() {415 return {416 x: Math.abs(cx - ix) < delta ? cx - ix : delta * (cx - ix) / Math.abs(cx - ix),417 y: Math.abs(cy - iy) < delta ? cy - iy : delta * (cy - iy) / Math.abs(cy - iy)418 };419 }420 }421 function reset_item() {422 item.removeClass('trx_addons_mouse_helper_near');423 inner424 .css({425 'transition': 'transform 0.5s',426 'transform': 'translate3d(0px, 0px, 0px)'427 })428 .one( typeof window.trx_addons_transition_end != 'undefined' ? trx_addons_transition_end() : 'transitionend', function () {429 inner.css({430 'transition': 'none'431 });432 });433 }434 } );435 }436 }437 } );438 // Add Mouse helper to the TOC menu439 $document.on( 'action.build_page_toc', function() {440 jQuery( '#toc_menu .toc_menu_item' ).each( function() {441 if ( TRX_ADDONS_STORAGE['mouse_helper'] > 0 ) {442 var $self = jQuery(this),443 title = $self.attr( 'title' ) || $self.find('.toc_menu_description_title').text();444 $self.attr( {445 'data-mouse-helper': 'hover',446 'data-mouse-helper-axis': 'y',447 'data-mouse-helper-text': TRX_ADDONS_STORAGE['msg_mouse_helper_anchor'] + ( title ? ' ' + title : '' )448 } );449 }450 } );451 } );...
op-restricted-names.js
Source:op-restricted-names.js
1var testCases = [2 {3 name: 'RestrictedNames',4 precondition: [5 {fullPath:'/a', isDirectory:true},6 {fullPath:'/b', isDirectory:true},7 {fullPath:'/c', isDirectory:true}8 ],9 tests: [10 function(helper) { helper.getFile('/', '.', {create:true}, FileError.SECURITY_ERR); },11 function(helper) { helper.getFile('/', '..', {create:true}, FileError.SECURITY_ERR); },12 function(helper) { helper.getFile('/', 'con', {create:true}, 0); },13 function(helper) { helper.getFile('/', 'CON', {create:true}, 0); },14 function(helper) { helper.getFile('/', 'Con', {create:true}, 0); },15 function(helper) { helper.getFile('/', 'cOn.txt', {create:true}, 0); },16 function(helper) { helper.getFile('/', 'a/coN', {create:true}, 0); },17 function(helper) { helper.getFile('/', 'prn', {create:true}, 0); },18 function(helper) { helper.getFile('/', 'PRN', {create:true}, 0); },19 function(helper) { helper.getFile('/', 'Prn', {create:true}, 0); },20 function(helper) { helper.getFile('/', 'pRn.txt', {create:true}, 0); },21 function(helper) { helper.getFile('/', 'a/prN', {create:true}, 0); },22 function(helper) { helper.getFile('/', 'aux', {create:true}, 0); },23 function(helper) { helper.getFile('/', 'AUX', {create:true}, 0); },24 function(helper) { helper.getFile('/', 'Aux', {create:true}, 0); },25 function(helper) { helper.getFile('/', 'aUx.txt', {create:true}, 0); },26 function(helper) { helper.getFile('/', 'a/auX', {create:true}, 0); },27 function(helper) { helper.getFile('/', 'nul', {create:true}, 0); },28 function(helper) { helper.getFile('/', 'NUL', {create:true}, 0); },29 function(helper) { helper.getFile('/', 'Nul', {create:true}, 0); },30 function(helper) { helper.getFile('/', 'nUl.txt', {create:true}, 0); },31 function(helper) { helper.getFile('/', 'a/nuL', {create:true}, 0); },32 function(helper) { helper.getFile('/', 'com1', {create:true}, 0); },33 function(helper) { helper.getFile('/', 'COM2', {create:true}, 0); },34 function(helper) { helper.getFile('/', 'Com4', {create:true}, 0); },35 function(helper) { helper.getFile('/', 'cOM7.foo', {create:true}, 0); },36 function(helper) { helper.getFile('/', 'a/coM9', {create:true}, 0); },37 function(helper) { helper.getFile('/', 'lpt1', {create:true}, 0); },38 function(helper) { helper.getFile('/', 'LPT2', {create:true}, 0); },39 function(helper) { helper.getFile('/', 'Lpt4', {create:true}, 0); },40 function(helper) { helper.getFile('/', 'lPT7.foo', {create:true}, 0); },41 function(helper) { helper.getFile('/', 'a/lpT9', {create:true}, 0); },42 function(helper) { helper.getFile('/', 'foo ', {create:true}, 0); },43 function(helper) { helper.getFile('/', 'foo\n', {create:true}, 0); },44 function(helper) { helper.getFile('/', 'foo.', {create:true}, 0); },45 function(helper) { helper.copy('/a', '/', 'foo ', 0); },46 function(helper) { helper.copy('/a', '/', 'foo\t', 0); },47 function(helper) { helper.copy('/a', '/', 'foo..', 0); },48 function(helper) { helper.move('/a', '/', 'foo ', 0); },49 function(helper) { helper.move('/b', '/', 'foo\t\t', 0); },50 function(helper) { helper.move('/c', '/', 'foo.....', 0); },51 ],52 postcondition: [53 {fullPath:'/foo ', isDirectory:true},54 {fullPath:'/foo\t\t', isDirectory:true},55 {fullPath:'/foo.....', isDirectory:true}56 ],57 },...
op-restricted-unicode.js
Source:op-restricted-unicode.js
1var testCases = [2 {3 name: 'RestrictedUnicodeChars',4 precondition: [ ],5 tests: [6 function(helper) { helper.getFile('/', 'ab', {create:true}); },7 // Embedded NULs aren't allowed; anything else in the first 32 is fair game.8 function(helper) { helper.getFile('/', 'a\u0000b', {create:true}, FileError.INVALID_MODIFICATION_ERR); },9 function(helper) { helper.getFile('/', 'a\u0001b', {create:true}, 0); },10 function(helper) { helper.getFile('/', 'a\u0002b', {create:true}, 0); },11 function(helper) { helper.getFile('/', 'a\u0003b', {create:true}, 0); },12 function(helper) { helper.getFile('/', 'a\u0004b', {create:true}, 0); },13 function(helper) { helper.getFile('/', 'a\u0005b', {create:true}, 0); },14 function(helper) { helper.getFile('/', 'a\u0006b', {create:true}, 0); },15 function(helper) { helper.getFile('/', 'a\u0007b', {create:true}, 0); },16 function(helper) { helper.getFile('/', 'a\u0008b', {create:true}, 0); },17 function(helper) { helper.getFile('/', 'a\u0009b', {create:true}, 0); },18 function(helper) { helper.getFile('/', 'a\u000ab', {create:true}, 0); },19 function(helper) { helper.getFile('/', 'a\u000bb', {create:true}, 0); },20 function(helper) { helper.getFile('/', 'a\u000cb', {create:true}, 0); },21 function(helper) { helper.getFile('/', 'a\u000db', {create:true}, 0); },22 function(helper) { helper.getFile('/', 'a\u000eb', {create:true}, 0); },23 function(helper) { helper.getFile('/', 'a\u000fb', {create:true}, 0); },24 function(helper) { helper.getFile('/', 'a\u0010b', {create:true}, 0); },25 function(helper) { helper.getFile('/', 'a\u0011b', {create:true}, 0); },26 function(helper) { helper.getFile('/', 'a\u0012b', {create:true}, 0); },27 function(helper) { helper.getFile('/', 'a\u0013b', {create:true}, 0); },28 function(helper) { helper.getFile('/', 'a\u0014b', {create:true}, 0); },29 function(helper) { helper.getFile('/', 'a\u0015b', {create:true}, 0); },30 function(helper) { helper.getFile('/', 'a\u0016b', {create:true}, 0); },31 function(helper) { helper.getFile('/', 'a\u0017b', {create:true}, 0); },32 function(helper) { helper.getFile('/', 'a\u0018b', {create:true}, 0); },33 function(helper) { helper.getFile('/', 'a\u0019b', {create:true}, 0); },34 function(helper) { helper.getFile('/', 'a\u001ab', {create:true}, 0); },35 function(helper) { helper.getFile('/', 'a\u001bb', {create:true}, 0); },36 function(helper) { helper.getFile('/', 'a\u001cb', {create:true}, 0); },37 function(helper) { helper.getFile('/', 'a\u001db', {create:true}, 0); },38 function(helper) { helper.getFile('/', 'a\u001eb', {create:true}, 0); }39 ],40 postcondition: [41 {fullPath:'/ab'},42 ],43 },...
wscript
Source:wscript
1## -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-2def build(bld):3 obj = bld.create_ns3_module('energy', ['network'])4 obj.source = [5 'model/energy-source.cc',6 'model/basic-energy-source.cc',7 'model/li-ion-energy-source.cc',8 'model/rv-battery-model.cc',9 'model/device-energy-model.cc',10 'model/device-energy-model-container.cc',11 'model/simple-device-energy-model.cc',12 'model/energy-harvester.cc',13 'model/basic-energy-harvester.cc',14 'helper/energy-source-container.cc',15 'helper/energy-model-helper.cc',16 'helper/basic-energy-source-helper.cc',17 'helper/li-ion-energy-source-helper.cc',18 'helper/rv-battery-model-helper.cc',19 'helper/energy-harvester-container.cc',20 'helper/energy-harvester-helper.cc',21 'helper/basic-energy-harvester-helper.cc',22 ]23 obj_test = bld.create_ns3_module_test_library('energy')24 obj_test.source = [25 'test/li-ion-energy-source-test.cc',26 'test/basic-energy-harvester-test.cc',27 ]28 headers = bld(features='ns3header')29 headers.module = 'energy'30 headers.source = [31 'model/energy-source.h',32 'model/basic-energy-source.h',33 'model/li-ion-energy-source.h',34 'model/rv-battery-model.h',35 'model/device-energy-model.h',36 'model/device-energy-model-container.h',37 'model/simple-device-energy-model.h',38 'model/energy-harvester.h',39 'model/basic-energy-harvester.h',40 'helper/energy-source-container.h',41 'helper/energy-model-helper.h',42 'helper/basic-energy-source-helper.h',43 'helper/li-ion-energy-source-helper.h',44 'helper/rv-battery-model-helper.h',45 'helper/energy-harvester-container.h',46 'helper/energy-harvester-helper.h',47 'helper/basic-energy-harvester-helper.h',48 ]49 if (bld.env['ENABLE_EXAMPLES']):50 bld.recurse('examples')...
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!!