@@ -234,11 +234,11 @@ public function testValidFieldSpec1()
234
234
235
235
$ fieldSpec = $ this ->fieldspec ('245[1-3] ' );
236
236
$ this ->assertSame (1 , $ fieldSpec ->getIndexStart ());
237
- $ this ->assertSame (3 , $ fieldSpec ->getIndexEnd ());
237
+ $ this ->assertSame (3 , $ fieldSpec ->getIndexEnd ());
238
238
239
239
$ fieldSpec = $ this ->fieldspec ('245[1-#] ' );
240
240
$ this ->assertSame (1 , $ fieldSpec ->getIndexStart ());
241
- $ this ->assertSame ('# ' , $ fieldSpec ->getIndexEnd ());
241
+ $ this ->assertSame ('# ' , $ fieldSpec ->getIndexEnd ());
242
242
243
243
$ fieldSpec = $ this ->fieldspec ('245[#-3] ' );
244
244
$ this ->assertSame ('# ' , $ fieldSpec ->getIndexStart ());
@@ -320,7 +320,7 @@ public function testValidFieldSpec23()
320
320
/**
321
321
* test character position and range
322
322
*/
323
- public function testSetAndGet ()
323
+ public function testSetAndGetChar ()
324
324
{
325
325
$ fieldSpec = $ this ->fieldspec ('LDR ' );
326
326
$ fieldSpec ->setCharStartEnd (0 ,3 );
@@ -349,8 +349,40 @@ public function testSetAndGet()
349
349
$ this ->assertSame ("# " , $ fieldSpec ->getCharStart ());
350
350
$ this ->assertSame (3 , $ fieldSpec ->getCharEnd ());
351
351
$ this ->assertSame (4 , $ fieldSpec ->getCharLength ());
352
+ }
353
+
354
+ /**
355
+ * test index position and range
356
+ */
357
+ public function testSetAndGetIndex ()
358
+ {
359
+ $ fieldSpec = $ this ->fieldspec ('300 ' );
360
+ $ fieldSpec ->setIndexStartEnd (0 ,3 );
361
+ $ this ->assertSame ('300 ' , $ fieldSpec ->getTag ());
362
+ $ this ->assertSame (0 , $ fieldSpec ->getIndexStart ());
363
+ $ this ->assertSame (3 , $ fieldSpec ->getIndexEnd ());
364
+ $ this ->assertSame (4 , $ fieldSpec ->getIndexLength ());
352
365
353
-
366
+ $ fieldSpec = $ this ->fieldspec ('300 ' );
367
+ $ fieldSpec ->setIndexStartEnd ("# " ,3 );
368
+ $ this ->assertSame ('300 ' , $ fieldSpec ->getTag ());
369
+ $ this ->assertSame ("# " , $ fieldSpec ->getIndexStart ());
370
+ $ this ->assertSame (3 , $ fieldSpec ->getIndexEnd ());
371
+ $ this ->assertSame (4 , $ fieldSpec ->getIndexLength ());
372
+
373
+ $ fieldSpec = $ this ->fieldspec ('300 ' );
374
+ $ fieldSpec ->setIndexStartEnd (0 ,4 );
375
+ $ this ->assertSame ('300 ' , $ fieldSpec ->getTag ());
376
+ $ this ->assertSame (0 , $ fieldSpec ->getIndexStart ());
377
+ $ this ->assertSame (4 , $ fieldSpec ->getIndexEnd ());
378
+ $ this ->assertSame (5 , $ fieldSpec ->getIndexLength ());
379
+
380
+ $ fieldSpec = $ this ->fieldspec ('300 ' );
381
+ $ fieldSpec ->setIndexStartLength ("# " ,4 );
382
+ $ this ->assertSame ('300 ' , $ fieldSpec ->getTag ());
383
+ $ this ->assertSame ("# " , $ fieldSpec ->getIndexStart ());
384
+ $ this ->assertSame (3 , $ fieldSpec ->getIndexEnd ());
385
+ $ this ->assertSame (4 , $ fieldSpec ->getIndexLength ());
354
386
}
355
387
356
388
/**
0 commit comments