forked from php/php-src
    
        
        - 
                Notifications
    
You must be signed in to change notification settings  - Fork 2
 
First fixes and tests for IntlBidi. #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            scholz-timo
  wants to merge
  52
  commits into
  sgolemon:bidi
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
scholz-timo:bidi
  
      
      
   
  
    
  
  
  
 
  
      
    base: bidi
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from 8 commits
      Commits
    
    
            Show all changes
          
          
            52 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      5ec8b65
              
                Fixed return types for getReorderingMode() and getReorderingOptions().
              
              
                scholz-timo 873fb9d
              
                Added embeddingLevels to IntlBidi::setPara()
              
              
                scholz-timo 6e423b8
              
                Fixed IntlBidi::getReordered()
              
              
                scholz-timo e6c2f6b
              
                Added tests.
              
              
                scholz-timo 96f37e7
              
                Updated parameter parsing to the fast paramter parsing api.
              
              
                scholz-timo c85537b
              
                Changed the call style of setLine to a java like approach and fixed t…
              
              
                scholz-timo 3bce63d
              
                Added comment.
              
              
                scholz-timo 340151c
              
                Removed duplicate in a test.
              
              
                scholz-timo 55c07f0
              
                Removed unnecessary memory zeroing.
              
              
                scholz-timo d785368
              
                Made function arguments nullable.
              
              
                scholz-timo 3cd9c17
              
                removed unnecessary emalloc calll, since erealloc with null has the s…
              
              
                scholz-timo f67506f
              
                Removed unnecessary comments and a unnecessary return
              
              
                scholz-timo f26405c
              
                Added tests.
              
              
                scholz-timo 6dcd0e4
              
                Renamed error method.
              
              
                scholz-timo 8874440
              
                Removed comments.
              
              
                scholz-timo 9229362
              
                Use FQN in constant
              
              
                JanSlabon e4f8844
              
                Added Copyright notice and source informations.
              
              
                scholz-timo 2297451
              
                Update ext/intl/tests/IntlBidi/IntlBidi_getBaseDirection_basic.phpt
              
              
                JanSlabon 172566d
              
                Removed IntlBidi::getCustomizedClass() + code style.
              
              
                scholz-timo 2711a10
              
                Deleted obsolete test
              
              
                JanSlabon 47bf076
              
                Added Copyright notices to tests.
              
              
                scholz-timo a84a7dc
              
                Added and optimized various tests
              
              
                JanSlabon da78f5e
              
                Fixed bug in IntlBidi::setLine()
              
              
                scholz-timo e45a197
              
                Updated tests
              
              
                scholz-timo c18d367
              
                Updated test name
              
              
                scholz-timo 208aeb4
              
                Removed zend-callstack object generation from IntlBidi::setLine()
              
              
                scholz-timo 757ceb5
              
                Tweaks in tests
              
              
                JanSlabon 94e7812
              
                Code style.
              
              
                scholz-timo 944e5d0
              
                Merge branch 'bidi' of https://github.com/OmniFaR/php-src into HEAD
              
              
                scholz-timo 7243c93
              
                Code style
              
              
                JanSlabon 8cedca2
              
                Added test for inverse behavior
              
              
                JanSlabon db9528b
              
                Added test
              
              
                JanSlabon 7646902
              
                Added and optimized various tests
              
              
                JanSlabon 54cbaa1
              
                Added test for getVisualRun() method.
              
              
                JanSlabon 22c1f5d
              
                Added test for IntlBidi::getProcessedLength() method
              
              
                JanSlabon 6b2a29e
              
                Test optimizations
              
              
                JanSlabon f984ec7
              
                Implemented parent managemant.
              
              
                scholz-timo 47e7e36
              
                Optimized Code style.
              
              
                scholz-timo bd93331
              
                Decoupled bidi instance from the zend_object.
              
              
                scholz-timo a1692a4
              
                Added parent instance management.
              
              
                scholz-timo df21864
              
                Added tests for maintaning bidi instances.
              
              
                scholz-timo ef9f04e
              
                Moved allocation logic in own function.
              
              
                scholz-timo a0aa537
              
                Code style and value type.
              
              
                scholz-timo b2383dd
              
                Code cleanup.
              
              
                scholz-timo a95a639
              
                Optimized test.
              
              
                scholz-timo de68d04
              
                Removed unnecessary space.
              
              
                scholz-timo 500c2d5
              
                code cleanup.
              
              
                scholz-timo 456776c
              
                Changed call order for freeing bidi_objects.
              
              
                scholz-timo c61e4db
              
                Merge branch 'bidi' of https://github.com/OmniFaR/php-src into HEAD
              
              
                scholz-timo 01d5c8b
              
                Restructured specific setLine() test.
              
              
                JanSlabon 46e5c90
              
                Fixed constructor and moved check into the constructor. Fixed nullabl…
              
              
                scholz-timo 69e133c
              
                Added support for chained setLine() calls.
              
              
                scholz-timo File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
      
      Oops, something went wrong.
      
    
  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --TEST-- | ||
| Regression test for the UBA implementation. | ||
| --CREDITS-- | ||
| Timo Scholz <[email protected]> | ||
| --SKIPIF-- | ||
| <?php if ( !extension_loaded('intl') ) print 'skip'; ?> | ||
| <?php if ( !extension_loaded('mbstring')) print 'skip'; ?> | ||
| --FILE-- | ||
| <?php | ||
| $bidi = new \IntlBidi(); | ||
| ?> | ||
| ==DONE== | ||
| --EXPECT-- | ||
| ==DONE== | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| --TEST-- | ||
| Regression test for the UBA implementation. | ||
| --CREDITS-- | ||
| Timo Scholz <[email protected]> | ||
| --SKIPIF-- | ||
| <?php if ( !extension_loaded('intl') ) print 'skip'; ?> | ||
| <?php if ( !extension_loaded('mbstring')) print 'skip'; ?> | ||
| --FILE-- | ||
| <?php | ||
| /** | ||
| * © 2016 and later: Unicode, Inc. and others. | ||
| * License & terms of use: http://www.unicode.org/copyright.html#License | ||
| * | ||
| ******************************************************************************* | ||
| * Copyright (C) 2001-2013, International Business Machines | ||
| * Corporation and others. All Rights Reserved. | ||
| ******************************************************************************* | ||
| */ | ||
| /** | ||
| * Ported from Java. | ||
| * Original: https://github.com/unicode-org/icu/blob/master/icu4j/main/tests/core/src/com/ibm/icu/dev/test/bidi/TestReorder.java | ||
| */ | ||
| 
     | 
||
| // include helper functions | ||
| include 'IntlBidi_ut_common.inc'; | ||
| 
     | 
||
| // the logical order of strings in a pseudo language. | ||
| $logicalOrder = [ | ||
| 'del(KC)add(K.C.&)', | ||
| 'del(QDVT) add(BVDL)', | ||
| 'del(PQ)add(R.S.)T)U.&', | ||
| 'del(LV)add(L.V.) L.V.&', | ||
| 'day 0 R DPDHRVR dayabbr', | ||
| 'day 1 H DPHPDHDA dayabbr', | ||
| 'day 2 L DPBLENDA dayabbr', | ||
| 'day 3 J DPJQVM dayabbr', | ||
| 'day 4 I DPIQNF dayabbr', | ||
| 'day 5 M DPMEG dayabbr', | ||
| 'helloDPMEG', | ||
| 'hello WXY' | ||
| ]; | ||
| 
     | 
||
| $nTests = \count($logicalOrder); | ||
| for ($testNumber = 0; $testNumber < $nTests; $testNumber++) { | ||
| 
     | 
||
| // prepare the source. | ||
| $src = $logicalOrder[$testNumber]; | ||
| // translate the pseudo language using a mapping. | ||
| $srcUt8 = pseudoToU8($src); | ||
| 
     | 
||
| $bidi = new \IntlBidi(); | ||
| $bidi->setInverse(true); | ||
| 
     | 
||
| $levels = str_repeat("\0", IntlBidi::MAX_EXPLICIT_LEVEL); | ||
| for ($i = 0; $i < 10; $i++) { | ||
| $levels[$i] = chr($i + 1); | ||
| } | ||
| 
     | 
||
| $bidi->setPara($srcUt8, \IntlBidi::DEFAULT_LTR, $levels); | ||
| $result = u8ToPseudo($bidi->getReordered(\IntlBidi::OUTPUT_REVERSE)); | ||
| var_dump($result); | ||
| } | ||
| ?> | ||
| ==DONE== | ||
| --EXPECT-- | ||
| string(17) ")K.C.&(KC)dda(led" | ||
| string(19) ")BVDL(ddaQDVT) (led" | ||
| string(21) "R.S.)T)U.&(PQ)dda(led" | ||
| string(22) "L.V.) L.V.&(LV)dda(led" | ||
| string(26) "rbbayad DPDHRVR R 0 yad" | ||
| string(27) "rbbayad DPHPDHDA H 1 yad" | ||
| string(28) "rbbayad DPBLENDA L 2 yad" | ||
| string(26) "rbbayad DPJQVM J 3 yad" | ||
| string(29) "rbbayad DPIQNF I 4 yad" | ||
| string(25) "rbbayad DPMEG M 5 yad" | ||
| string(10) "DPMEGolleh" | ||
| string(9) "WXY olleh" | ||
| ==DONE== | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| --TEST-- | ||
| Regression test for the UBA implementation. | ||
| --CREDITS-- | ||
| Timo Scholz <[email protected]> | ||
| --SKIPIF-- | ||
| <?php if ( !extension_loaded('intl') ) print 'skip'; ?> | ||
| <?php if ( !extension_loaded('mbstring')) print 'skip'; ?> | ||
| --FILE-- | ||
| <?php | ||
| /** | ||
| * © 2016 and later: Unicode, Inc. and others. | ||
| * License & terms of use: http://www.unicode.org/copyright.html#License | ||
| * | ||
| ******************************************************************************* | ||
| * Copyright (C) 2001-2013, International Business Machines | ||
| * Corporation and others. All Rights Reserved. | ||
| ******************************************************************************* | ||
| */ | ||
| /** | ||
| * Ported from Java. | ||
| * Original: https://github.com/unicode-org/icu/blob/master/icu4j/main/tests/core/src/com/ibm/icu/dev/test/bidi/TestReorder.java | ||
| */ | ||
| 
     | 
||
| include 'IntlBidi_ut_common.inc'; | ||
| 
     | 
||
| // --- INIT TEST DATA --- | ||
| 
     | 
||
| $logicalOrder = [ | ||
| 'del(KC)add(K.C.&)', | ||
| 'del(QDVT) add(BVDL)', | ||
| 'del(PQ)add(R.S.)T)U.&', | ||
| 'del(LV)add(L.V.) L.V.&', | ||
| 'day 0 R DPDHRVR dayabbr', | ||
| 'day 1 H DPHPDHDA dayabbr', | ||
| 'day 2 L DPBLENDA dayabbr', | ||
| 'day 3 J DPJQVM dayabbr', | ||
| 'day 4 I DPIQNF dayabbr', | ||
| 'day 5 M DPMEG dayabbr', | ||
| 'helloDPMEG', | ||
| 'hello WXY' | ||
| ]; | ||
| 
     | 
||
| // --- RUN TEST --- | ||
| 
     | 
||
| $nTests = \count($logicalOrder); | ||
| for ($testNumber = 0; $testNumber < $nTests; $testNumber++) { | ||
| 
     | 
||
| // prepare the source. | ||
| $src = $logicalOrder[$testNumber]; | ||
| $srcUt8 = pseudoToU8($src); | ||
| 
     | 
||
| $bidi = new \IntlBidi(); | ||
| $bidi->setInverse(true); | ||
| $levels = str_repeat("\0", IntlBidi::MAX_EXPLICIT_LEVEL); | ||
| for ($i = 0; $i < 10; $i++) { | ||
| $levels[$i] = chr($i + 1); | ||
| } | ||
| $bidi->setPara($srcUt8, \IntlBidi::DEFAULT_LTR, $levels); | ||
| $result = u8ToPseudo($bidi->getReordered(\IntlBidi::DO_MIRRORING | \IntlBidi::REMOVE_BIDI_CONTROLS)); | ||
| var_dump($result); | ||
| } | ||
| ?> | ||
| ==DONE== | ||
| --EXPECT-- | ||
| string(16) "del(add(CK(.C.K)" | ||
| string(19) "del( (TVDQadd(LDVB)" | ||
| string(20) "del(add(QP(.U(T(.S.R" | ||
| string(21) "del(add(VL(.V.L (.V.L" | ||
| string(26) "day 0 R RVRHDPD dayabbr" | ||
| string(27) "day 1 H ADHDPHPD dayabbr" | ||
| string(28) "day 2 L ADNELBPD dayabbr" | ||
| string(26) "day 3 J MVQJPD dayabbr" | ||
| string(29) "day 4 I FNQIPD dayabbr" | ||
| string(25) "day 5 M GEMPD dayabbr" | ||
| string(10) "helloGEMPD" | ||
| string(9) "hello YXW" | ||
| ==DONE== | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --TEST-- | ||
| Regression test for the UBA implementation. | ||
| --CREDITS-- | ||
| Timo Scholz <[email protected]> | ||
| --SKIPIF-- | ||
| <?php if ( !extension_loaded('intl') ) print 'skip'; ?> | ||
| <?php if ( !extension_loaded('mbstring')) print 'skip'; ?> | ||
| --FILE-- | ||
| <?php | ||
| /** | ||
| * © 2016 and later: Unicode, Inc. and others. | ||
| * License & terms of use: http://www.unicode.org/copyright.html#License | ||
| * | ||
| ******************************************************************************* | ||
| * Copyright (C) 2001-2013, International Business Machines | ||
| * Corporation and others. All Rights Reserved. | ||
| ******************************************************************************* | ||
| */ | ||
| /** | ||
| * Ported from Java. | ||
| * Original: https://github.com/unicode-org/icu/blob/master/icu4j/main/tests/core/src/com/ibm/icu/dev/test/bidi/TestReorder.java | ||
| */ | ||
| 
     | 
||
| include 'IntlBidi_ut_common.inc'; | ||
| 
     | 
||
| // --- INIT TEST DATA --- | ||
| 
     | 
||
| $logicalOrder = [ | ||
| 'del(KC)add(K.C.&)', | ||
| 'del(QDVT) add(BVDL)', | ||
| 'del(PQ)add(R.S.)T)U.&', | ||
| 'del(LV)add(L.V.) L.V.&', | ||
| 'day 0 R DPDHRVR dayabbr', | ||
| 'day 1 H DPHPDHDA dayabbr', | ||
| 'day 2 L DPBLENDA dayabbr', | ||
| 'day 3 J DPJQVM dayabbr', | ||
| 'day 4 I DPIQNF dayabbr', | ||
| 'day 5 M DPMEG dayabbr', | ||
| 'helloDPMEG', | ||
| 'hello WXY' | ||
| ]; | ||
| 
     | 
||
| // --- RUN TEST --- | ||
| 
     | 
||
| $nTests = \count($logicalOrder); | ||
| for ($testNumber = 0; $testNumber < $nTests; $testNumber++) { | ||
| 
     | 
||
| // prepare the source. | ||
| $src = $logicalOrder[$testNumber]; | ||
| $srcUt8 = pseudoToU8($src); | ||
| 
     | 
||
| $bidi = new \IntlBidi(); | ||
| $bidi->setPara($srcUt8, \IntlBidi::DEFAULT_LTR); | ||
| $result = u8ToPseudo($bidi->getReordered(\IntlBidi::DO_MIRRORING)); | ||
| var_dump($result); | ||
| } | ||
| ?> | ||
| ==DONE== | ||
| --EXPECT-- | ||
| string(17) "del(CK)add(&.C.K)" | ||
| string(19) "del(TVDQ) add(LDVB)" | ||
| string(21) "del(QP)add(S.R.)&.U(T" | ||
| string(22) "del(VL)add(V.L.) &.V.L" | ||
| string(26) "day 0 RVRHDPD R dayabbr" | ||
| string(27) "day 1 ADHDPHPD H dayabbr" | ||
| string(28) "day 2 ADNELBPD L dayabbr" | ||
| string(26) "day 3 MVQJPD J dayabbr" | ||
| string(29) "day 4 FNQIPD I dayabbr" | ||
| string(25) "day 5 GEMPD M dayabbr" | ||
| string(10) "helloGEMPD" | ||
| string(9) "hello YXW" | ||
| ==DONE== | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| --TEST-- | ||
| Regression test for the UBA implementation. | ||
| --CREDITS-- | ||
| Timo Scholz <[email protected]> | ||
| --SKIPIF-- | ||
| <?php if ( !extension_loaded('intl') ) print 'skip'; ?> | ||
| <?php if ( !extension_loaded('mbstring')) print 'skip'; ?> | ||
| --FILE-- | ||
| <?php | ||
| /** | ||
| * © 2016 and later: Unicode, Inc. and others. | ||
| * License & terms of use: http://www.unicode.org/copyright.html#License | ||
| * | ||
| ******************************************************************************* | ||
| * Copyright (C) 2001-2013, International Business Machines | ||
| * Corporation and others. All Rights Reserved. | ||
| ******************************************************************************* | ||
| */ | ||
| /** | ||
| * Ported from Java. | ||
| * Original: https://github.com/unicode-org/icu/blob/master/icu4j/main/tests/core/src/com/ibm/icu/dev/test/bidi/TestReorder.java | ||
| */ | ||
| 
     | 
||
| include 'IntlBidi_ut_common.inc'; | ||
| 
     | 
||
| // --- INIT TEST DATA --- | ||
| 
     | 
||
| $logicalOrder = [ | ||
| 'del(KC)add(K.C.&)', | ||
| 'del(QDVT) add(BVDL)', | ||
| 'del(PQ)add(R.S.)T)U.&', | ||
| 'del(LV)add(L.V.) L.V.&', | ||
| 'day 0 R DPDHRVR dayabbr', | ||
| 'day 1 H DPHPDHDA dayabbr', | ||
| 'day 2 L DPBLENDA dayabbr', | ||
| 'day 3 J DPJQVM dayabbr', | ||
| 'day 4 I DPIQNF dayabbr', | ||
| 'day 5 M DPMEG dayabbr', | ||
| 'helloDPMEG', | ||
| 'hello WXY' | ||
| ]; | ||
| 
     | 
||
| // --- RUN TEST --- | ||
| 
     | 
||
| $nTests = \count($logicalOrder); | ||
| for ($testNumber = 0; $testNumber < $nTests; $testNumber++) { | ||
| 
     | 
||
| // prepare the source. | ||
| $src = $logicalOrder[$testNumber]; | ||
| $srcUt8 = pseudoToU8($src); | ||
| 
     | 
||
| $bidi = new \IntlBidi(); | ||
| $bidi->setPara($srcUt8, \IntlBidi::DEFAULT_LTR); | ||
| $result = u8ToPseudo($bidi->getReordered(\IntlBidi::DO_MIRRORING | \IntlBidi::OUTPUT_REVERSE)); | ||
| var_dump($result); | ||
| } | ||
| ?> | ||
| ==DONE== | ||
| --EXPECT-- | ||
| string(17) ")K.C.&(dda)KC(led" | ||
| string(19) ")BVDL(dda )QDVT(led" | ||
| string(21) "T(U.&).R.S(dda)PQ(led" | ||
| string(22) "L.V.& ).L.V(dda)LV(led" | ||
| string(26) "rbbayad R DPDHRVR 0 yad" | ||
| string(27) "rbbayad H DPHPDHDA 1 yad" | ||
| string(28) "rbbayad L DPBLENDA 2 yad" | ||
| string(26) "rbbayad J DPJQVM 3 yad" | ||
| string(29) "rbbayad I DPIQNF 4 yad" | ||
| string(25) "rbbayad M DPMEG 5 yad" | ||
| string(10) "DPMEGolleh" | ||
| string(9) "WXY olleh" | ||
| ==DONE== | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| --TEST-- | ||
| Regression test for the UBA implementation. | ||
| --CREDITS-- | ||
| Timo Scholz <[email protected]> | ||
| --SKIPIF-- | ||
| <?php if ( !extension_loaded('intl') ) print 'skip'; ?> | ||
| <?php if ( !extension_loaded('mbstring')) print 'skip'; ?> | ||
| --FILE-- | ||
| <?php | ||
| /** | ||
| * © 2016 and later: Unicode, Inc. and others. | ||
| * License & terms of use: http://www.unicode.org/copyright.html#License | ||
| * | ||
| ******************************************************************************* | ||
| * Copyright (C) 2001-2013, International Business Machines | ||
| * Corporation and others. All Rights Reserved. | ||
| ******************************************************************************* | ||
| */ | ||
| /** | ||
| * Ported from Java. | ||
| * Original: https://github.com/unicode-org/icu/blob/master/icu4j/main/tests/core/src/com/ibm/icu/dev/test/bidi/TestReorder.java | ||
| */ | ||
| 
     | 
||
| include 'IntlBidi_ut_common.inc'; | ||
| 
     | 
||
| // --- INIT TEST DATA --- | ||
| 
     | 
||
| $logicalOrder = [ | ||
| 'del(KC)add(K.C.&)', | ||
| 'del(QDVT) add(BVDL)', | ||
| 'del(PQ)add(R.S.)T)U.&', | ||
| 'del(LV)add(L.V.) L.V.&', | ||
| 'day 0 R DPDHRVR dayabbr', | ||
| 'day 1 H DPHPDHDA dayabbr', | ||
| 'day 2 L DPBLENDA dayabbr', | ||
| 'day 3 J DPJQVM dayabbr', | ||
| 'day 4 I DPIQNF dayabbr', | ||
| 'day 5 M DPMEG dayabbr', | ||
| 'helloDPMEG', | ||
| 'hello WXY' | ||
| ]; | ||
| 
     | 
||
| // --- RUN TEST --- | ||
| 
     | 
||
| $nTests = \count($logicalOrder); | ||
| for ($testNumber = 0; $testNumber < $nTests; $testNumber++) { | ||
| 
     | 
||
| // prepare the source. | ||
| $src = $logicalOrder[$testNumber]; | ||
| $srcUt8 = pseudoToU8($src); | ||
| 
     | 
||
| $bidi = new \IntlBidi(); | ||
| $bidi->setInverse(true); | ||
| $bidi->setPara($srcUt8, \IntlBidi::DEFAULT_LTR); | ||
| $result = u8ToPseudo($bidi->getReordered(\IntlBidi::OUTPUT_REVERSE | \IntlBidi::INSERT_LRM_FOR_NUMERIC)); | ||
| var_dump($result); | ||
| } | ||
| ?> | ||
| ==DONE== | ||
| --EXPECT-- | ||
| string(22) "@)@K.C.&@(dda)@KC@(led" | ||
| string(24) "@)@BVDL@(dda )@QDVT@(led" | ||
| string(24) "R.S.)T)U.&@(dda)@PQ@(led" | ||
| string(25) "L.V.) L.V.&@(dda)@LV@(led" | ||
| string(28) "rbbayad @R DPDHRVR@ 0 yad" | ||
| string(29) "rbbayad @H DPHPDHDA@ 1 yad" | ||
| string(30) "rbbayad @L DPBLENDA@ 2 yad" | ||
| string(28) "rbbayad @J DPJQVM@ 3 yad" | ||
| string(31) "rbbayad @I DPIQNF@ 4 yad" | ||
| string(27) "rbbayad @M DPMEG@ 5 yad" | ||
| string(10) "DPMEGolleh" | ||
| string(10) "WXY@ olleh" | ||
| ==DONE== | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.