Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 817

Show
Ignore:
Timestamp:
12/24/10 05:24:25 (14 years ago)
Author:
braddr
Message:

Enable tests that pass without opt since we're ignoring opt issues for the time being.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/test/Makefile

    r815 r817  
    7979export ARGS=-inline -release -gc -O -unittest -fPIC 
    8080export DMD=../src/dmd 
    8181export EXE= 
    8282export OBJ=.o 
    8383export DSEP=/ 
    8484export SEP=/ 
    8585endif 
    8686 
    8787runnable_tests=$(wildcard runnable/*.d) $(wildcard runnable/*.html) $(wildcard runnable/*.sh) 
    8888runnable_test_results=$(addsuffix .out,$(addprefix $(RESULTS_DIR)/,$(runnable_tests))) 
    8989 
    9090compilable_tests=$(wildcard compilable/*.d) 
    9191compilable_test_results=$(addsuffix .out,$(addprefix $(RESULTS_DIR)/,$(compilable_tests))) 
    9292 
    9393fail_compilation_tests=$(wildcard fail_compilation/*.d) 
    9494fail_compilation_test_results=$(addsuffix .out,$(addprefix $(RESULTS_DIR)/,$(fail_compilation_tests))) 
    9595 
    9696all: run_tests 
    9797 
    9898ifeq ($(MODEL),64) 
    99 DISABLED_TESTS = \ 
    100     a20           \ 
    101     argufilem     \ 
    102     arrayop       \ 
    103     builtin       \ 
    104     complex       \ 
    105     constfold     \ 
    106     cov2          \ 
    107     delegate      \ 
    108     dhry          \ 
    109     eh2           \ 
    110     foreach4      \ 
    111     foreach5      \ 
    112     hello-profile \ 
    113     hospital      \ 
    114     ifti          \ 
    115     implicit      \ 
    116     inner         \ 
    117     integrate     \ 
    118     interpret2    \ 
    119     interpret     \ 
    120     lazy          \ 
    121     mixin1        \ 
    122     mixin2        \ 
    123     nested        \ 
    124     pi            \ 
    125     printargs     \ 
    126     s2ir          \ 
    127     sieve         \ 
    128     statictor     \ 
    129     stress        \ 
    130     template1     \ 
    131     template4     \ 
    132     template6     \ 
    133     template9     \ 
    134     test11        \ 
    135     test12        \ 
    136     test16        \ 
    137     test19        \ 
    138     test20        \ 
    139     test22        \ 
    140     test23        \ 
    141     test28        \ 
    142     test34        \ 
    143     test36        \ 
    144     test37        \ 
    145     test42        \ 
    146     test4         \ 
    147     test52        \ 
    148     test60        \ 
    149     test7         \ 
    150     test8         \ 
    151     testaa2       \ 
    152     testaa        \ 
    153     testarray     \ 
    154     testconst     \ 
    155     testdate      \ 
    156     testdstress   \ 
    157     testformat    \ 
    158     testgc2       \ 
    159     testgc3       \ 
    160     testline      \ 
    161     testmath      \ 
    162     testmmfile    \ 
    163     testregexp2   \ 
    164     testsignals   \ 
    165     testfile      \ 
    166     testswitch    \ 
    167     testthread2   \ 
    168     testtypeid    \ 
    169     testzip       \ 
    170     traits        \ 
    171     untag         \ 
    172     variadic      \ 
    173     wc2           \ 
    174     wc3           \ 
    175     wc            \ 
    176     xtest46       \ 
    177     xtest55 
     99DISABLED_TESTS = a20 
     100DISABLED_TESTS += cov2 
     101DISABLED_TESTS += hello-profile 
     102DISABLED_TESTS += sieve 
     103# coverage / tracing is broken 
     104 
     105DISABLED_TESTS += arrayop 
     106# value isn't making it into the runtime library call for some reason 
     107 
     108DISABLED_TESTS += builtin 
     109DISABLED_TESTS += integrate 
     110DISABLED_TESTS += testmath 
     111# needs std.math 
     112 
     113DISABLED_TESTS += delegate 
     114# array literal with delegate 
     115 
     116DISABLED_TESTS += eh2 
     117DISABLED_TESTS += test4 
     118DISABLED_TESTS += test12 
     119DISABLED_TESTS += test42 
     120DISABLED_TESTS += testsignals 
     121DISABLED_TESTS += xtest46 
     122# hangs at exit, somewhere in atomic code? 
     123 
     124DISABLED_TESTS += foreach4 
     125# iterate over dstring as char returning bad results 
     126 
     127DISABLED_TESTS += hospital 
     128# int vs long issues 
     129 
     130DISABLED_TESTS += interpret 
     131# array literal with struct 
     132 
     133DISABLED_TESTS += s2ir 
     134DISABLED_TESTS += test16 
     135DISABLED_TESTS += test20 
     136DISABLED_TESTS += test28 
     137# -fPIC: transition from R_X86_64_TLSGD to R_X86_64_GOTTPOFF against 
     138 
     139DISABLED_TESTS += stress 
     140# hangs off in the gc 
     141 
     142DISABLED_TESTS += template4 
     143# segv's off in an opCall, not clear why 
     144 
     145DISABLED_TESTS += test11 
     146# array append issues? test33 
     147 
     148DISABLED_TESTS += test22 
     149#  has x86 specific asm code that needs translation 
     150 
     151DISABLED_TESTS += test34 
     152DISABLED_TESTS += testformat 
     153# looks like lots of issues with std.format, at least array and aa formatting is borked.. 
     154 
     155DISABLED_TESTS += test7 
     156# interesting array manipulation test fails 
     157 
     158DISABLED_TESTS += test8 
     159# segv in rt.deh2.__eh_find_caller 
     160 
     161DISABLED_TESTS += testaa2 
     162# aa.values returns wrong data 
     163 
     164DISABLED_TESTS += testaa 
     165# segv in memcmp related to aa.keys 
     166 
     167DISABLED_TESTS += testarray 
     168# sensitive code checking a specific runtime bug 
     169 
     170DISABLED_TESTS += testconst 
     171# segv in a misleading place.. printfs around the functions in the backtrace 
     172# not firing.  More research needed. 
     173 
     174DISABLED_TESTS += testgc2 
     175DISABLED_TESTS += testgc3 
     176DISABLED_TESTS += untag 
     177DISABLED_TESTS += wc2 
     178DISABLED_TESTS += wc3 
     179DISABLED_TESTS += wc 
     180# various gc related issues 
     181 
     182DISABLED_TESTS += testmmfile 
     183# mm issues, probably 
     184 
     185DISABLED_TESTS += testregexp2 
     186# needs std/regexp to be fixed first 
     187 
     188DISABLED_TESTS += testthread2 
     189# segv 
     190 
     191DISABLED_TESTS += testzip 
     192# zlib version error 
    178193 
    179194$(addsuffix .d.out,$(addprefix $(RESULTS_DIR)/runnable/,$(DISABLED_TESTS))): $(RESULTS_DIR)/.created 
    180195    $(QUIET) echo " ... $@ - disabled" 
    181     $(QUIET) touch $@ 
    182196 
    183197$(RESULTS_DIR)/runnable/test2.sh.out: 
    184198    $(QUIET) echo " ... $@ - disabled" 
    185199    $(QUIET) touch $@ 
    186200 
    187201$(RESULTS_DIR)/runnable/%.d.out: runnable/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) 
    188202    $(QUIET) ./do_test.sh $(<D) $* d 
    189203 
    190204$(RESULTS_DIR)/runnable/%.html.out: runnable/%.html $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) 
    191205    $(QUIET) ./do_test.sh $(<D) $* html 
    192206 
    193207$(RESULTS_DIR)/runnable/%.sh.out: runnable/%.sh $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) 
    194208    $(QUIET) echo " ... $(<D)/$*.sh" 
    195209    $(QUIET) ./$(<D)/$*.sh 
    196210 
    197211$(RESULTS_DIR)/compilable/%.d.out: compilable/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) 
    198212    $(QUIET) ./do_test.sh $(<D) $* d 
    199213 
    200214$(RESULTS_DIR)/fail_compilation/%.d.out: fail_compilation/%.d $(RESULTS_DIR)/.created $(RESULTS_DIR)/combinations $(DMD) 
    201215    $(QUIET) ./do_test.sh $(<D) $* d 
  • trunk/test/runnable/interpret.d

    r794 r817  
    13231323} 
    13241324 
    13251325/************************************************/ 
    13261326 
    13271327int foo70(int[ string ] a) 
    13281328{ 
    13291329    a["world"] = 5; 
    13301330    auto x = (a["hello"] += 7); 
    13311331    assert(x == 10); 
    13321332    assert(x == a["hello"]); 
    13331333    return a["hello"] + a["betty"] + a["world"]; 
    13341334} 
    13351335 
    13361336void test70() 
    13371337{ 
    13381338    static assert(foo70( ["hello":3, "betty":4] ) == 19); 
    13391339} 
    13401340 
    13411341/************************************************/ 
    13421342 
    1343 int foo71(int[ string ] a) 
     1343size_t foo71(int[ string ] a) 
    13441344{ 
    13451345    return a.length; 
    13461346} 
    13471347 
    13481348void test71() 
    13491349{ 
    13501350    static assert(foo71( ["hello":3, "betty":4] ) == 2); 
    13511351} 
    13521352 
    13531353/************************************************/ 
    13541354 
    13551355string[] foo72(int[ string ] a) 
    13561356{ 
    13571357    return a.keys; 
    13581358} 
    13591359 
    13601360void test72() 
    13611361{ 
    13621362    static assert(foo72( ["hello":3, "betty":4] ) == ["hello", "betty"]); 
    13631363} 
     
    16001600struct S84 { int a; } 
    16011601 
    16021602int func84() 
    16031603{ 
    16041604    S84 [] s = [S84(7)]; 
    16051605    return s[0].a; // Error: cannot evaluate func() at compile time 
    16061606} 
    16071607 
    16081608void test84() 
    16091609{ 
    16101610    const int x = func84(); 
    16111611    assert(x == 7); 
    16121612} 
    16131613 
    16141614/************************************************/ 
    16151615 
    16161616struct S85 { 
    16171617    int a; 
    16181618} 
    16191619 
    1620 int func85() 
     1620size_t func85() 
    16211621{ 
    16221622    S85 [] s; 
    16231623    s ~= S85(7); 
    16241624    return s.length; 
    16251625} 
    16261626 
    16271627void test85() 
    16281628{ 
    1629     const int x = func85(); 
     1629    const size_t x = func85(); 
    16301630    assert(x == 1); 
    16311631} 
    16321632 
    16331633/************************************************/ 
    16341634 
    16351635struct Bar86 
    16361636{ 
    16371637    int x; 
    16381638    char[] s; 
    16391639} 
    16401640 
    16411641char[] foo86() 
    16421642{ 
    16431643    Bar86 bar; 
    16441644    return bar.s; 
    16451645} 
    16461646 
    16471647void test86() 
    16481648{ 
    16491649    static x = foo86(); 
     
    26512651int bug4052() { 
    26522652    int[] arr = new int[1]; 
    26532653    int s; 
    26542654    foreach (x; arr) 
    26552655        s += x; 
    26562656    foreach (x; arr) 
    26572657        s += x * x; 
    26582658    return 4052; 
    26592659} 
    26602660static assert(bug4052()==4052); 
    26612661 
    26622662int bug4252() 
    26632663{ 
    26642664    char [] s = "abc".dup; 
    26652665    s[15] = 'd'; // Array bounds error 
    26662666    return 3; 
    26672667} 
    26682668 
    26692669static assert(!is(typeof( Compileable!(bug4252())))); 
    26702670 
    2671 int setlen1() 
     2671size_t setlen1() 
    26722672{ 
    26732673   int [] w = new int[4]; 
    26742674   w[] = 7; 
    26752675   w.length = 6; 
    26762676   return 21 + w.length; 
    26772677} 
    26782678 
    26792679static assert(setlen1()==27); 
    26802680 
    2681 int setlen2() 
     2681size_t setlen2() 
    26822682{ 
    26832683   int [] w; 
    26842684   w.length = 15; 
    26852685   assert(w[3]==0); 
    26862686   w[2]=8; 
    26872687   w[14]=7; 
    26882688   w.length = 12; // check shrinking 
    26892689   assert(w[2]==8); 
    26902690   return 2 + w.length; 
    26912691} 
    26922692 
    26932693static assert(setlen2()==14); 
    26942694 
    26952695/************************************************/ 
    26962696 
    26972697int bug4257(ref int x) { 
    26982698  return 3; 
    26992699} 
    27002700 
    27012701int bug4257c(int x) { 
  • trunk/test/runnable/template1.d

    r713 r817  
    11// REQUIRED_ARGS: -d 
    22 
    33module template1; 
    44 
    5 import std.c.stdio; 
     5import core.stdc.stdio : printf; 
     6import core.vararg; 
    67 
    78/******************************************/ 
    89 
    910template TFoo1(T,U) 
    1011{ 
    1112    int foo(T t, U u) 
    1213    { 
    1314    return 3; 
    1415    } 
    1516} 
    1617 
    1718 
    1819alias TFoo1!(int, char) Foo1; 
    1920 
    2021 
    2122void test1() 
    2223{ 
    2324    int i = Foo1.foo(1, 2); 
    2425    assert(i == 3); 
    2526} 
     
    775776    { 
    776777    printf("Specialization\n"); 
    777778    to = from;  
    778779    } 
    779780} 
    780781 
    781782void test30() 
    782783{  
    783784    int i = 0; 
    784785    float f = 0; 
    785786    string s; 
    786787 
    787788    alias TCopy30!(int) copyint; 
    788789    alias TCopy30!(string) copystr; 
    789790 
    790791    copyint.copy(i, 3);  
    791792    printf("%d\n", i); 
    792793    assert(i == 3); 
    793794 
    794795    copystr.copy(s, "Here it comes"); 
    795     printf("%.*s\n", s); 
     796    printf("%.*s\n", s.length, s.ptr); 
    796797    assert(s == "Here it comes"); 
    797798} 
    798799 
    799800/******************************************/ 
    800801 
    801802import std.string; 
    802803 
    803804template Foo31(alias X) 
    804805{ 
    805806    alias X.toString y; 
    806807} 
    807808 
    808809void test31() 
    809810{ 
    810811    alias Foo31!(std.string) bar; 
    811812} 
    812813 
    813814 
    814815/******************************************/ 
    815816 
     
    13711372    Bar55 a; 
    13721373    Foo55 b; 
    13731374    b.test(a); 
    13741375    Bar55.test(a); 
    13751376} 
    13761377 
    13771378/******************************************/ 
    13781379 
    13791380template CT56(T) 
    13801381{ 
    13811382  class C 
    13821383  { 
    13831384    const char[][1] arrArr=["foo" ]; 
    13841385  } 
    13851386} 
    13861387 
    13871388void test56() 
    13881389{ 
    13891390  alias CT56!(int) Ct; 
    13901391  Ct.C c= new Ct.C(); 
    1391   printf("%.*s\n", c.arrArr[0]); 
     1392  printf("%.*s\n", c.arrArr[0].length, c.arrArr[0].ptr); 
    13921393  assert(c.arrArr[0] == "foo"); 
    13931394} 
    13941395 
    13951396 
    13961397/******************************************/ 
    13971398 
    13981399template foo57(T : int = int) 
    13991400{ 
    14001401    T x = 3; 
    14011402} 
    14021403 
    14031404void test57() 
    14041405{ 
    14051406    printf("%d\n", foo57!().x); 
    14061407    assert(foo57!().x == 3); 
    14071408} 
    14081409 
    14091410/******************************************/ 
    14101411 
    14111412template Foo58(T, U = T) 
     
    14651466    {}; 
    14661467} 
    14671468 
    14681469void test60() 
    14691470{ 
    14701471    B60!(int, long).Thing   thing1; 
    14711472    B60!(int).Thing     thing2; 
    14721473 
    14731474    printf("thing1.sizeof: %u\n", thing1.sizeof); 
    14741475    printf("thing2.sizeof: %u\n", thing2.sizeof); 
    14751476 
    14761477    version (Win32) 
    14771478    assert(thing1.sizeof == 16); 
    14781479    else 
    14791480    assert(thing1.sizeof == 12); 
    14801481    assert(thing2.sizeof == 8); 
    14811482 
    14821483    C60!(int /*,A60*/ ).C60 container1; 
    14831484 
    14841485    printf("container1.sizeof: %u\n", container1.sizeof); 
    1485     assert(container1.sizeof == 4); 
     1486    assert(container1.sizeof == (void*).sizeof); 
    14861487} 
    14871488 
    14881489/******************************************/ 
    14891490 
    14901491struct Foo61 
    14911492{ 
    14921493    int a; 
    14931494 
    14941495    template Bar(T) 
    14951496    { 
    14961497    T abc() { return a; } 
    14971498    } 
    14981499 
    14991500    int def() { return 4; } 
    15001501} 
    15011502 
    15021503void test61() 
    15031504{ 
    15041505    Foo61 *f = new Foo61(); 
    15051506    int i; 
     
    15681569    static int opCall (qfloat x, qfloat y, qfloat z) { return 8; } 
    15691570} 
    15701571 
    15711572void test64() 
    15721573{ 
    15731574    int i; 
    15741575    i = XVector!(int)(1,2,3); 
    15751576    assert(i == 8); 
    15761577    i = XVector!(real).opCall(1,2,3); 
    15771578    assert(i == 8); 
    15781579} 
    15791580 
    15801581/******************************************/ 
    15811582 
    15821583typedef int value_type; 
    15831584 
    15841585struct Foo65 
    15851586{ 
    15861587    uint length() { return 47; } 
    15871588 
    1588     int test() 
     1589    size_t test() 
    15891590    { 
    15901591    value_type[] e = new value_type[length]; 
    15911592    return e.length; 
    15921593    } 
    15931594} 
    15941595 
    15951596void test65() 
    15961597{ 
    15971598    Foo65 f; 
    15981599 
    15991600    assert(f.test() == 47); 
    16001601} 
    16011602 
    16021603/******************************************/ 
    16031604 
    16041605class Thing66 
    16051606{ 
    16061607    template print(T2) 
    16071608    { 
    16081609        void print(T2 t) 
     
    16101611            printf("t = %d\n", t); 
    16111612            assert(t == 10); 
    16121613        } 
    16131614    } 
    16141615} 
    16151616 
    16161617 
    16171618void test66() 
    16181619{ 
    16191620    Thing66 thing = new Thing66; 
    16201621 
    16211622    thing.print!(int)(10); 
    16221623} 
    16231624 
    16241625/******************************************/ 
    16251626 
    16261627template Foo67(alias T) 
    16271628{ 
    16281629    void Foo67() 
    16291630    { 
    1630     printf("T = '%.*s'\n", T); 
     1631    printf("T = '%.*s'\n", T.length, T.ptr); 
    16311632    assert(T == "hello"); 
    16321633    } 
    16331634} 
    16341635 
    16351636void test67() 
    16361637{ 
    16371638    static string x = "hello"; 
    16381639 
    16391640    Foo67!(x)(); 
    16401641} 
    16411642 
    16421643 
    16431644/******************************************/ 
    16441645 
    16451646template T68(int a) { 
    16461647    int vec[a]; 
    16471648} 
    16481649 
    16491650void test68() 
    16501651{ 
    16511652    int i; 
    16521653 
    16531654    i = T68!(4>1?4:1).vec[0]; 
    16541655    assert(i == 0); 
    16551656    i = T68!(4==1?1:(1==1?4:(4>1?1:4))).vec[0]; 
    16561657    assert(i == 0); 
    16571658} 
    16581659 
    16591660/******************************************/ 
    16601661 
    1661 int printx(string s) 
    1662 { 
    1663     printf("s = '%.*s'\n", s); 
     1662size_t printx(string s) 
     1663{ 
     1664    printf("s = '%.*s'\n", s.length, s.ptr); 
    16641665    return s.length; 
    16651666} 
    16661667 
    1667 int printx(int i) 
     1668size_t printx(int i) 
    16681669{ 
    16691670    printf("i = %d\n", i); 
    16701671    return 28; 
    16711672} 
    16721673 
    16731674template Foo69(alias T) 
    16741675{ 
    1675  int Foo69() 
     1676 size_t Foo69() 
    16761677 { 
    16771678  return printx(T); 
    16781679 } 
    16791680} 
    16801681 
    16811682void test69() 
    16821683{ 
    16831684 static string x = "hello"; 
    16841685 static string z = "abc"; 
    16851686 static int y=100; 
    1686  int i; 
     1687 size_t i; 
    16871688 
    16881689 alias Foo69!(x) foox; 
    16891690 alias Foo69!(y) fooy; 
    16901691 
    16911692    i = Foo69!(x)(); 
    16921693    assert(i == 5); 
    16931694    i = Foo69!(y)(); 
    16941695    assert(i == 28); 
    16951696    i = Foo69!(z)(); 
    16961697    assert(i == 3); 
    16971698    i = foox(); 
    16981699    assert(i == 5); 
    16991700    i = fooy(); 
    17001701    assert(i == 28); 
    17011702} 
    17021703 
    17031704/******************************************/ 
    17041705 
    17051706template temptt70(alias func) 
    17061707{ 
     
    17401741{ 
    17411742    Aint71.AT a; 
    17421743    a.x = 3; 
    17431744} 
    17441745 
    17451746/******************************************/ 
    17461747 
    17471748template foo72(T) 
    17481749{ 
    17491750    char[] foo72(T d) 
    17501751    { 
    17511752    uint sz = typeof(d[0]).sizeof * 2; 
    17521753    return null; 
    17531754    } 
    17541755} 
    17551756 
    17561757void test72() 
    17571758{ 
    17581759    static ulong[5] a = [0,1,2,3,4]; 
    17591760    static uint[5] b = [0,1,2,3,4]; 
    1760     printf("%.*s\n",foo72!(ulong[5])(a)); 
    1761     printf("%.*s\n",foo72!(uint[5])(b)); 
     1761    char[] r; 
     1762    r = foo72!(ulong[5])(a); printf("%.*s\n", r.length, r.ptr); 
     1763    r = foo72!(uint[5])(b);  printf("%.*s\n", r.length, r.ptr); 
    17621764} 
    17631765 
    17641766 
    17651767/******************************************/ 
    17661768 
    17671769typedef int Int73; 
    17681770class Test73(T = Int73); 
    17691771alias Test73!() Foo73; 
    17701772 
    17711773void test73() 
    17721774{ 
    17731775} 
    17741776 
    17751777/******************************************/ 
    17761778 
    17771779class A74 
    17781780{ 
    17791781    typedef A74 atype; 
    17801782    int x; 
    17811783} 
  • trunk/test/runnable/test11.d

    r749 r817  
    11// for two uses of volatile 
    22// REQUIRED_ARGS: -d 
    33 
    44extern(C) int printf(const char*, ...); 
    55extern(C) size_t strlen(const char*); 
    66 
    77/**************************************/ 
    88 
    99alias strlen foo1; 
    1010 
    1111void test1() 
    1212{ 
    1313    const(char) *p = "bar"; 
    14     int i; 
    15  
    16     i = foo1(p); 
     14    size_t i = foo1(p); 
    1715    assert(i == 3); 
    1816} 
    1917 
    2018/**************************************/ 
    2119 
    2220template Foo2(T) 
    2321{ 
    2422    alias T t; 
    2523} 
    2624 
    2725alias Foo2!(int) t1; 
    2826alias Foo2!(int).t t2; 
    2927alias t1.t t3; 
    3028alias t2 t4; 
    3129alias Foo2!(int) t5; 
    3230 
    3331void test2() 
    3432{ 
    3533    t1.t v1; 
    3634    t2 v2; 
     
    6664 
    6765    debug(stdchar) 
    6866    { 
    6967    string line="It is a long line."; 
    7068    string delimiter="is"; 
    7169    } 
    7270 
    7371    debug(stdbyte) 
    7472    { 
    7573    byte[] line=cast(byte[])cast(string)"It is a long line."; 
    7674    byte[] delimiter=cast(byte[])cast(string)"is"; 
    7775    } 
    7876 
    7977    debug(stdwchar) 
    8078    { 
    8179    wstring line="It is a long line."; 
    8280    wstring delimiter="is"; 
    8381    } 
    8482    int ptr=3; 
    8583 
    86     int dl=delimiter.length; 
    87     int pl=ptr+dl; 
     84    size_t dl=delimiter.length; 
     85    size_t pl=ptr+dl; 
    8886 
    8987    assert(line[ptr..pl]==delimiter[]); 
    9088} 
    9189 
    9290 
    9391/**************************************/ 
    9492 
    9593void test4() 
    9694{ 
    9795    byte* p; 
    9896 
    99     assert(p.sizeof == 4); 
     97    version(X86) 
     98        assert(p.sizeof == 4); 
     99    else version(X86_64) 
     100        assert(p.sizeof == 8); 
     101    else 
     102        assert(false, "unknown platform"); 
    100103} 
    101104 
    102105/**************************************/ 
    103106 
    104107void test5a(int *j) 
    105108{ 
    106109    int i; 
    107110 
    108111    volatile i = *j; 
    109112    volatile i = *j; 
    110113} 
    111114 
    112115void test5() 
    113116{ 
    114117    int x; 
    115118 
    116119    test5a(&x); 
    117120} 
    118121 
    119122 
  • trunk/test/runnable/test23.d

    r749 r817  
    11// REQUIRED_ARGS: -d 
    22 
    33module test; 
    44 
     5import core.vararg; 
     6import core.stdc.stdlib; 
    57import std.stdio; 
    6 import std.c.stdlib; 
    78import std.string; 
    89 
    910 
    1011/*******************************************/ 
    1112 
    1213struct S 
    1314{ 
    1415    int opSliceAssign(int v, size_t i, size_t j) 
    1516    { 
    1617    assert(v == 5); 
    1718    assert(i == 9); 
    1819    assert(j == 10); 
    1920    return 3; 
    2021    } 
    2122 
    2223    int opSliceAssign(int v) 
    2324    { 
    2425    assert(v == 6); 
    2526    return 11; 
    2627    } 
     
    390391    long b; 
    391392  } 
    392393  STRUCTB19 c; 
    393394} 
    394395 
    395396struct STRUCTB19 
    396397{ 
    397398  int a; 
    398399}  
    399400 
    400401void test19() 
    401402{ 
    402403} 
    403404 
    404405/*******************************************/ 
    405406 
    406407class Foo20 
    407408{ 
    408409        void bar (void * src) 
    409410        { 
    410                 void baz (void function (void *, uint) xyz) 
     411                void baz (void function (void *, size_t) xyz) 
    411412                { 
    412                         uint foo (void [] dst) 
     413                        size_t foo (void [] dst) 
    413414                        { 
    414                                 uint len = dst.length; 
     415                                size_t len = dst.length; 
    415416                                dst [0 .. len] = src [0 .. len]; 
    416417                                xyz (dst.ptr, len); 
    417418                                return len; 
    418419                        } 
    419420                } 
    420421        } 
    421422} 
    422423 
    423424void test20() 
    424425{ 
    425426} 
    426427 
    427428/*******************************************/ 
    428429 
    429430class Baz21 
    430431{ 
    431432        int opApply (int delegate(ref int) dg) 
    432433        { 
    433434                int i; 
    434435                return dg(i); 
     
    751752union  O_O { int a; } 
    752753class  O_o { int a; } 
    753754 
    754755struct Foo34 
    755756{ 
    756757    int ok; 
    757758    o_O foo; 
    758759    O_O bar; 
    759760    O_o baz; 
    760761} 
    761762 
    762763void test34() 
    763764{ 
    764765    int o1 = Foo34.ok.offsetof; 
    765766    assert(o1 == 0); 
    766767    int o2 = Foo34.foo.offsetof; 
    767768    assert(o2 == 4); 
    768769    int o3 = Foo34.bar.offsetof; 
    769770    assert(o3 == 8); 
    770771    int o4 = Foo34.baz.offsetof; 
    771     assert(o4 == 12); 
     772    assert((o4 % (void*).sizeof) == 0); 
     773    assert(o4 > o3); 
    772774} 
    773775 
    774776/*******************************************/ 
    775777 
    776778struct vegetarian 
    777779{ 
    778780    carrots areYummy; 
    779781} 
    780782 
    781783typedef ptrdiff_t carrots; 
    782784 
    783785void test35() 
    784786{ 
    785787    assert(vegetarian.sizeof == ptrdiff_t.sizeof); 
    786788} 
    787789 
    788790/*******************************************/ 
    789791 
    790792void test36() 
    791793{ 
  • trunk/test/runnable/test28.d

    r666 r817  
    11module test; 
    22 
     3import core.vararg; 
    34import std.stdio; 
    45import std.string; 
    56 
    67extern(C) int printf(const char*, ...); 
    78 
    89/*******************************************/ 
    910 
    1011struct S1 
    1112{ 
    1213    void* function(void*) fn; 
    1314} 
    1415 
    1516template M1() 
    1617{ 
    1718    S1 s; 
    1819} 
    1920 
    2021void test1() 
    2122{ 
    2223    S1 s2; 
     
    916917    writefln("%s", MY_CONST_STRING); 
    917918    } 
    918919} 
    919920 
    920921void never_called44() 
    921922{ 
    922923    // This can be anything; there just needs to be a reference to 
    923924    // A44.MY_CONST_STRING somewhere. 
    924925    writefln("%s", A44.MY_CONST_STRING); 
    925926} 
    926927 
    927928void test44() 
    928929{ 
    929930    A44 a = new A44(); 
    930931} 
    931932 
    932933/*******************************************/ 
    933934 
    934935class C45 
    935936{ 
    936     void func(lazy uint x) 
     937    void func(lazy size_t x) 
    937938    { 
    938939    (new C45).func(super.toHash()); 
    939940    } 
    940941} 
    941942 
    942943void test45() 
    943944{ 
    944945} 
    945946 
    946947/*******************************************/ 
    947948 
    948949template T46(double v) 
    949950{ 
    950951    double T46 = v; 
    951952} 
    952953 
    953954void test46() 
    954955{ 
    955956    double g = T46!(double.nan) + T46!(-double.nan); 
    956957} 
  • trunk/test/runnable/test8.d

    r713 r817  
    828828class Node41 
    829829{ 
    830830   W41 v; 
    831831} 
    832832 
    833833void test41() 
    834834{ 
    835835    Node41 n = new Node41; 
    836836 
    837837    printf("n.v.x == %d\n", n.v.x); 
    838838    assert(n.v.x == 3); 
    839839} 
    840840 
    841841 
    842842/***********************************/ 
    843843 
    844844int foo42(const(char) *x, ...) 
    845845{ 
    846846    va_list ap; 
    847847 
    848     va_start!(typeof(x))(ap, x); 
     848    version(X86) va_start!(typeof(x))(ap, x); else va_start(ap, __va_argsave); 
    849849    printf("&x = %p, ap = %p\n", &x, ap); 
    850850 
    851851    int i; 
    852852    i = va_arg!(typeof(i))(ap); 
    853853    printf("i = %d\n", i); 
    854854 
    855855    long l; 
    856856    l = va_arg!(typeof(l))(ap); 
    857857    printf("l = %lld\n", l); 
    858858 
    859859    uint k; 
    860860    k = va_arg!(typeof(k))(ap); 
    861861    printf("k = %u\n", k); 
    862862 
    863863    va_end(ap); 
    864864 
    865865    return cast(int)(i + l + k); 
    866866} 
    867867 
    868868void test42() 
  • trunk/test/runnable/testaa2.d

    r545 r817  
    11// PERMUTE_ARGS: 
    22 
    33extern(C) int printf(const char*, ...); 
    44 
    55int main() 
    66{ 
    77    testaa(); 
    88    printf("Success\n"); 
    99    return 0; 
    1010} 
    1111 
    1212void testaa() 
    13 {   int i; 
    14  
    15     i = foo("abc"); 
     13
     14    size_t i = foo("abc"); 
    1615    printf("i = %d\n", i); 
    1716    assert(i == 0); 
    1817 
    1918    foo2(); 
    2019} 
    2120 
    2221int a[string]; 
    2322 
    24 int foo(invariant char [3] s) 
     23size_t foo(invariant char [3] s) 
    2524{ 
    2625    printf("foo()\n"); 
    2726    int b[string]; 
    2827    string[] key; 
    2928    int[] value; 
    3029    printf("foo() 2\n"); 
    3130    key = a.keys; 
    3231    printf("foo() 3\n"); 
    3332    value = a.values; 
    3433    printf("foo() 4\n"); 
    3534    return a.length + b.length; 
    3635} 
    3736 
    3837void foo2() 
    3938{ 
    4039    int c[string]; 
    4140    string[] key; 
    4241    int[] value; 
    4342    int i; 
    4443 
  • trunk/test/runnable/testthread2.d

    r575 r817  
    4141 
    4242    void remove(K key) { 
    4343        size_t i = 0; 
    4444        for(; i < keys.length; i++) { 
    4545            if(keys[i] == key) { 
    4646                break; 
    4747            } 
    4848        } 
    4949 
    5050        assert(i < keys.length); 
    5151 
    5252        for(; i < keys.length - 1; i++) { 
    5353            keys[i] = keys[i + 1]; 
    5454            values[i] = values[i + 1]; 
    5555        } 
    5656 
    5757        keys = keys[0..$ - 1]; 
    5858        values = values[0..$ - 1]; 
    5959    } 
    6060 
    61     uint length() { 
     61    size_t length() { 
    6262        return values.length; 
    6363    } 
    6464} 
    6565 
    6666void main() { 
    6767    foreach(iter; 0..10) {  // Bug only happens after a few iterations. 
    6868        writeln(iter); 
    69         uint[uint] builtin; 
    70         LinearAA!(uint, uint) linAA; 
     69        uint[size_t] builtin; 
     70        LinearAA!(size_t, uint) linAA; 
    7171        uint[] nums = new uint[100_000]; 
    7272        foreach(ref num; nums) { 
    7373            num = uniform(0U, uint.max); 
    7474        } 
    7575 
    7676        foreach(i; 0..10_000) { 
    7777            auto index = uniform(0, nums.length); 
    7878            if(index in builtin) { 
    7979                assert(index in linAA); 
    8080                assert(builtin[index] == nums[index]); 
    8181                assert(linAA[index] == nums[index]); 
    8282                builtin.remove(index); 
    8383                linAA.remove(index); 
    8484            } else { 
    8585                assert(!(index in linAA)); 
    8686                builtin[index] = nums[index]; 
    8787                linAA[index] = nums[index]; 
    8888            } 
    8989        } 
    9090 
  • trunk/test/runnable/xtest46.d

    r755 r817  
    156156 
    157157void test7() 
    158158{ 
    159159    C7 t = new C7(); 
    160160    t.a = 4; 
    161161    t.b = 5; 
    162162    t.c = 6; 
    163163    assert(t.a == 4); 
    164164    assert(t.b == 5); 
    165165    assert(t.c == 6); 
    166166    assert(t.s.b == 0); 
    167167    assert(t.sizeof == (void*).sizeof); 
    168168    assert(t.init is null); 
    169169} 
    170170 
    171171/***************************************************/ 
    172172 
    173173void foo8(int n1 = __LINE__ + 0, int n2 = __LINE__, string s = __FILE__) 
    174174{ 
    175175    assert(n1 < n2); 
    176     printf("n1 = %d, n2 = %d, s = %.*s\n", n1, n2, s); 
     176    printf("n1 = %d, n2 = %d, s = %.*s\n", n1, n2, s.length, s.ptr); 
    177177} 
    178178 
    179179void test8() 
    180180{ 
    181181    foo8(); 
    182182} 
    183183 
    184184/***************************************************/ 
    185185 
    186186void foo9(int n1 = __LINE__ + 0, int n2 = __LINE__, string s = __FILE__)() 
    187187{ 
    188188    assert(n1 < n2); 
    189     printf("n1 = %d, n2 = %d, s = %.*s\n", n1, n2, s); 
     189    printf("n1 = %d, n2 = %d, s = %.*s\n", n1, n2, s.length, s.ptr); 
    190190} 
    191191 
    192192void test9() 
    193193{ 
    194194    foo9(); 
    195195} 
    196196 
    197197/***************************************************/ 
    198198 
    199199int foo10(char c) pure nothrow 
    200200{ 
    201201    return 1; 
    202202} 
    203203 
    204204void test10() 
    205205{ 
    206206    int function(char c) fp; 
    207207    int function(char c) pure nothrow fq; 
    208208 
    209209    fp = &foo10; 
     
    893893sort!((string a, string b) { return freqs[a] > freqs[b]; })(words); 
    894894//sort!(bool (a, b) { return freqs[a] > freqs[b]; })(words); 
    895895//sort!(function (a, b) { return freqs[a] > freqs[b]; })(words); 
    896896//sort!(function bool(a, b) { return freqs[a] > freqs[b]; })(words); 
    897897sort!(delegate bool(string a, string b) { return freqs[a] > freqs[b]; })(words); 
    898898 
    899899} 
    900900 
    901901void test48() 
    902902{ 
    903903} 
    904904 
    905905/***************************************************/ 
    906906 
    907907struct S49 
    908908{ 
    909909    static void* p; 
    910910 
    911911    this( string name ) 
    912912    { 
    913     printf( "(ctor) &%.*s.x = %p\n", name, &x ); 
     913    printf( "(ctor) &%.*s.x = %p\n", name.length, name.ptr, &x ); 
    914914    p = cast(void*)&x; 
    915915    } 
    916916 
    917917    invariant() {} 
    918918 
    919919    int x; 
    920920} 
    921921 
    922922void test49() 
    923923{ 
    924924    auto s = new S49("s2"); 
    925925 
    926926    printf( "&s2.x = %p\n", &s.x ); 
    927927    assert(cast(void*)&s.x == S49.p); 
    928928} 
    929929 
    930930/***************************************************/ 
    931931 
    932932auto max50(Ts...)(Ts args) 
    933933  if (Ts.length >= 2 
     
    16181618void mouse(){ 
    16191619    Bulldog!(int).cat(0); 
    16201620} 
    16211621 
    16221622void test87() 
    16231623{ 
    16241624    double[] d1 = [ 6.0, 1.5, 2.4, 3 ]; 
    16251625    double[] d2 = [ 1.5, 2.4 ]; 
    16261626    assert(find(d1, d2) == d1[1 .. $]); 
    16271627    assert(find(d1, d2) == d1[1 .. $]); // Check for memory corruption 
    16281628    assert(max(4, 5) == 5); 
    16291629    assert(max(3, 4, 5) == 5); 
    16301630} 
    16311631 
    16321632/***************************************************/ 
    16331633 
    16341634struct S88 
    16351635{ 
    16361636    void opDispatch(string s, T)(T i) 
    16371637    { 
    1638     printf("S.opDispatch('%.*s', %d)\n", s, i); 
     1638    printf("S.opDispatch('%.*s', %d)\n", s.length, s.ptr, i); 
    16391639    } 
    16401640} 
    16411641 
    16421642class C88 
    16431643{ 
    16441644    void opDispatch(string s)(int i) 
    16451645    { 
    1646     printf("C.opDispatch('%.*s', %d)\n", s, i); 
     1646    printf("C.opDispatch('%.*s', %d)\n", s.length, s.ptr, i); 
    16471647    } 
    16481648} 
    16491649 
    16501650struct D88 
    16511651{ 
    16521652    template opDispatch(string s) 
    16531653    { 
    16541654    enum int opDispatch = 8; 
    16551655    } 
    16561656} 
    16571657 
    16581658void test88() 
    16591659{ 
    16601660    S88 s; 
    16611661    s.opDispatch!("hello")(7); 
    16621662    s.foo(7); 
    16631663 
    16641664    auto c = new C88(); 
    16651665    c.foo(8); 
    16661666