Mercurial > octave-nkf
comparison test/index.tst @ 17642:7ed397c8ca68
improve compatibility of null assignment (bug #31287)
* Array.cc (Array<T>::delete_elements (const Array<idx_vector>&)):
Improve compatibility when indices references an empty slice.
* Sparse.cc (Sparse<T>::delete_elements (const idx_vector&, const
idx_vector&)): Likewise.
(Sparse<T>::delete_elements (const idx_vector&)): Likewise.
* index.tst: New tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Fri, 11 Oct 2013 23:39:54 -0400 |
parents | b81b9d079515 |
children | d63878346099 |
comparison
equal
deleted
inserted
replaced
17641:cd5a6008ae72 | 17642:7ed397c8ca68 |
---|---|
225 %!error d(6,6); | 225 %!error d(6,6); |
226 %!error dd(6,6); | 226 %!error dd(6,6); |
227 %!error d(3,6); | 227 %!error d(3,6); |
228 %!error dd(3,6); | 228 %!error dd(3,6); |
229 | 229 |
230 ## bug 31287 | |
231 %!test | |
232 %! y = ones (2, 2, 2); | |
233 %! x = ones (2, 2, 2); | |
234 %! x(false) = []; | |
235 %! assert (x, y); | |
236 | |
237 %!test | |
238 %! y = ones (2, 2, 2); | |
239 %! x = ones (2, 2, 2); | |
240 %! x(false,[]) = []; | |
241 %! assert (x, y); | |
242 | |
243 %!test | |
244 %! y = ones (2, 2, 2); | |
245 %! x = ones (2, 2, 2); | |
246 %! x(false,[],false) = []; | |
247 %! assert (x, y); | |
248 | |
249 %!shared x, y | |
250 %! y = ones (2, 2, 2); | |
251 %! x = ones (2, 2, 2); | |
252 %! x(false, 1) = []; | |
253 %! assert (x, y); | |
254 | |
255 %!shared x, y | |
256 %! y = ones (2, 2, 2); | |
257 %! x = ones (2, 2, 2); | |
258 %! x(false, false) = []; | |
259 %! assert (x, y); | |
260 | |
261 %!test | |
262 %! y = ones (2, 2); | |
263 %! x = ones (2, 2); | |
264 %! x([], []) = []; | |
265 %! assert (x, y); | |
266 | |
267 %!test | |
268 %! y = sparse (ones (2, 2)); | |
269 %! x = sparse (ones (2, 2)); | |
270 %! x([], []) = []; | |
271 %! assert (x, y); | |
272 | |
273 %!test | |
274 %! y = ones (2, 2); | |
275 %! x = ones (2, 2); | |
276 %! x(1, []) = []; | |
277 %! assert (x, y); | |
278 | |
279 %!test | |
280 %! y = ones (2, 2); | |
281 %! x = ones (2, 2); | |
282 %! x([], 1, []) = []; | |
283 %! assert (x, y); | |
284 | |
285 %!test | |
286 %! y = ones (2, 2); | |
287 %! x = ones (2, 2); | |
288 %! x(1, [], 1, 1) = []; | |
289 %! assert (x, y); | |
290 | |
291 %!test | |
292 %! y = ones (2, 2); | |
293 %! x = ones (2, 2); | |
294 %! x([], 1, 1) = []; | |
295 %! assert (x, y); | |
296 | |
297 %!test | |
298 %! y = ones (2, 2); | |
299 %! x = ones (2, 2); | |
300 %! ea2 = ones (3, 2, 0, 2); | |
301 %! x(1, ea2) = []; | |
302 %! assert (x, y); | |
303 | |
304 %!test | |
305 %! y = sparse (ones (2, 2)); | |
306 %! x = sparse (ones (2, 2)); | |
307 %! ea2 = ones (3, 2, 0, 2); | |
308 %! x(1, ea2) = []; | |
309 %! assert (x, y); | |
310 | |
311 %!test | |
312 %! y = ones (2, 2); | |
313 %! x = ones (2, 2); | |
314 %! ea2 = ones (3, 2, 0, 2); | |
315 %! x([], 1, ea2) = []; | |
316 %! assert (x, y); | |
317 | |
318 %!test | |
319 %! y = ones (2, 2); | |
320 %! x = ones (2, 2); | |
321 %! ea2 = ones (3, 2, 0, 2); | |
322 %! x(1, ea2, ea2) = []; | |
323 %! assert (x, y); | |
324 | |
325 %!test | |
326 %! y = ones (2, 2); | |
327 %! x = ones (2, 2); | |
328 %! ea2 = ones (3, 2, 0, 2); | |
329 %! x(1, ea2, 1) = []; | |
330 %! assert (x, y); | |
331 | |
332 %!test | |
333 %! y = ones (2, 2); | |
334 %! x = ones (2, 2); | |
335 %! x(false, 1) = []; | |
336 %! assert (x, y); | |
337 | |
338 %!test | |
339 %! y = sparse (ones (2, 2)); | |
340 %! x = sparse (ones (2, 2)); | |
341 %! x(false, 1) = []; | |
342 %! assert (x, y); | |
343 | |
344 %!test | |
345 %! y = ones (2, 2); | |
346 %! x = ones (2, 2); | |
347 %! x(1, [], false) = []; | |
348 %! assert (x, y); | |
349 | |
350 %!test | |
351 %! y = ones (2, 2); | |
352 %! x = ones (2, 2); | |
353 %! x(false, false) = []; | |
354 %! assert (x, y); | |
355 | |
356 %!test | |
357 %! y = sparse (ones (2, 2)); | |
358 %! x = sparse (ones (2, 2)); | |
359 %! x(false, false) = []; | |
360 %! assert (x, y); | |
361 | |
362 %!test | |
363 %! y = ones (2, 2); | |
364 %! x = ones (2, 2); | |
365 %! x(false, [], false) = []; | |
366 %! assert (x, y); | |
367 | |
368 %!test | |
369 %! y = ones (2, 2); | |
370 %! x = ones (2, 2); | |
371 %! x([], false, false, false) = []; | |
372 %! assert (x, y); | |
373 | |
374 %!test | |
375 %! y = ones (2, 2); | |
376 %! x = ones (2, 2); | |
377 %! x(1, [], false, false) = []; | |
378 %! assert (x, y); | |
379 | |
380 %!test | |
381 %! y = ones (2, 2); | |
382 %! x = ones (2, 2); | |
383 %! x(:, false) = []; | |
384 %! assert (x, y); | |
385 | |
386 %!test | |
387 %! y = sparse (ones (2, 2)); | |
388 %! x = sparse (ones (2, 2)); | |
389 %! x(:, false) = []; | |
390 %! assert (x, y); | |
391 | |
392 %!test | |
393 %! y = ones (2, 2); | |
394 %! x = ones (2, 2); | |
395 %! x(false, :) = []; | |
396 %! assert (x, y); | |
397 | |
398 %!test | |
399 %! y = sparse (ones (2, 2)); | |
400 %! x = sparse (ones (2, 2)); | |
401 %! x(false, :) = []; | |
402 %! assert (x, y); | |
403 | |
404 %!test | |
405 %! y = ones (2, 2); | |
406 %! x = ones (2, 2); | |
407 %! x(false, :, [], 1) = []; | |
408 %! assert (x, y); | |
409 | |
410 %!test | |
411 %! y = ones (2, 2); | |
412 %! x = ones (2, 2); | |
413 %! x(:, [], false) = []; | |
414 %! assert (x, y); | |
415 | |
416 %!shared x, y | |
417 %! y = ones (2, 2); | |
418 %! x = ones (2, 2); | |
419 %!error x(1, 1, []) = []; | |
420 | |
421 %!shared x, y | |
422 %! y = ones (2, 2); | |
423 %! x = ones (2, 2); | |
424 %! x(false, false, 1) = []; | |
425 %! assert (x, y); | |
426 | |
427 %!shared x, y | |
428 %! y = ones (2, 2); | |
429 %! x = ones (2, 2); | |
430 %! x(false, false, []) = []; | |
431 %! assert (x, y); | |
432 | |
433 %!shared x, y | |
434 %! y = ones (2, 2); | |
435 %! x = ones (2, 2); | |
436 %! x(false, false, [], false) = []; | |
437 %! assert (x, y); | |
438 | |
439 %!shared x, y | |
440 %! y = ones (2, 2); | |
441 %! x = ones (2, 2); | |
442 %! x(1, false, [], false) = []; | |
443 %! assert (x, y); | |
444 | |
445 %!shared x, y | |
446 %! y = ones (2, 2); | |
447 %! x = ones (2, 2); | |
448 %! x(:, false, 1) = []; | |
449 %! assert (x, y); | |
450 | |
451 %!test | |
452 %! y = ones (2, 2); | |
453 %! x = ones (2, 2); | |
454 %! x([]) = []; | |
455 %! assert (x, y); | |
456 | |
457 %!test | |
458 %! y = sparse (ones (2, 2)); | |
459 %! x = sparse (ones (2, 2)); | |
460 %! x([]) = []; | |
461 %! assert (x, y); | |
462 | |
463 %!test | |
464 %! y = []; | |
465 %! x = ones (2, 2); | |
466 %! x(:) = []; | |
467 %! assert (x, y); | |
468 | |
469 %!test | |
470 %! y = sparse ([]); | |
471 %! x = sparse (ones (2, 2)); | |
472 %! x(:) = []; | |
473 %! assert (x, y); | |
474 | |
475 %!test | |
476 %! y = ones (2, 2); | |
477 %! x = ones (2, 2); | |
478 %! x(false) = []; | |
479 %! assert (x, y); | |
480 | |
481 %!test | |
482 %! y = sparse (ones (2, 2)); | |
483 %! x = sparse (ones (2, 2)); | |
484 %! x(false) = []; | |
485 %! assert (x, y); | |
486 | |
487 %!test | |
488 %! y = ones (2, 2); | |
489 %! x = ones (2, 2); | |
490 %! x([], false) = []; | |
491 %! assert (x, y); | |
492 | |
493 %!test | |
494 %! y = sparse (ones (2, 2)); | |
495 %! x = sparse (ones (2, 2)); | |
496 %! x([], false) = []; | |
497 %! assert (x, y); | |
498 | |
499 %!test | |
500 %! y = ones (2, 2); | |
501 %! x = ones (2, 2); | |
502 %! x([], false, :) = []; | |
503 %! assert (x, y); |