File: test.jl.fold

package info (click to toggle)
kf6-syntax-highlighting 6.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 47,568 kB
  • sloc: xml: 197,750; cpp: 12,850; python: 3,023; sh: 955; perl: 546; ruby: 488; pascal: 393; javascript: 161; php: 150; jsp: 132; lisp: 131; haskell: 124; ada: 119; ansic: 107; makefile: 96; f90: 94; ml: 85; cobol: 81; yacc: 71; csh: 62; erlang: 54; sql: 51; java: 47; objc: 37; awk: 31; asm: 30; tcl: 29; fortran: 18; cs: 10
file content (127 lines) | stat: -rw-r--r-- 3,882 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Test file for Julia

# Comment

<beginfold id='1'>#=</beginfold id='1'> Multi-line
   comment <endfold id='1'>=#</endfold id='1'>

<beginfold id='2'>#BEGIN</beginfold id='2'>

<endfold id='2'>#END</endfold id='2'>

using Random, LinearAlgebra
x = 1 + 1
using DataFrames, Tables,   
    HDF5, # this is a comment
    Plots
using DataFrames, Tables,
    
    # this is a comment
    Plots
x = x ยฑ 2
using SparseArrays: SparseMatrixCSC
using Sockets: Sockets, connect,
    listen,
    getaddrinfo
x = x^3
using Statistics:
    std,
    stdm

<beginfold id='3'>"""</beginfold id='3'>
 Multi-line string
<endfold id='3'>"""</endfold id='3'>
<beginfold id='3'>```</beginfold id='3'>
 Multi-line command
<endfold id='3'>```</endfold id='3'>
raw"string\a\\a"

"string $testvar interpolation"
"string \$testvar interpolation"
"string $(collect(1:10) .^ 3) interpolation"
"string \$(collect(1:10) .^ 3) interpolation"

<beginfold id='4'>let</beginfold id='4'> z = zip(1:2, 3:4, 5:6)
    @test size(z) == (2,)
    @test collect(z) == [(1,3,5), (2,4,6)]
    @test eltype(z) == Tuple{Int,Int,Int}
<endfold id='4'>end</endfold id='4'>

@testset "generic conversion from Integer" <beginfold id='4'>begin</beginfold id='4'>
    x = rand(Int128)
    @test BigInt(x) % Int128 === x
    y = rand(UInt128)
    @test BigInt(y) % UInt128 === y
<endfold id='4'>end</endfold id='4'>

@testset "show" <beginfold id='4'>begin</beginfold id='4'>
    @test sprint(show, BitSet()) == "BitSet([])"
    @test sprint(show, BitSet([1,2,3])) == "BitSet([1, 2, 3])"
    show(IOBuffer(), BitSet())
<endfold id='4'>end</endfold id='4'>

cmd = `$(Base.julia_cmd()) --depwarn=error --startup-file=no boundscheck_exec.jl`
<beginfold id='4'>if</beginfold id='4'> !success(pipeline(cmd; stdout=stdout, stderr=stderr))
    error("boundscheck test failed, cmd : $cmd")
<endfold id='4'>end</endfold id='4'>

@test iterate(I, CartesianIndex(3, typemax(Int)))[1] == CartesianIndex(4,typemax(Int))
@test iterate(I, CartesianIndex(4, typemax(Int)))    === nothing
@test_throws MethodError write(IOBuffer(), ASCIIChar('x'))
@test_throws MethodError read(IOBuffer('x'), ASCIIChar)

<beginfold id='4'>let</beginfold id='4'> header = "julia [switches] -- [programfile] [args...]"
    @test startswith(read(`$exename -h`, String), header)
    @test startswith(read(`$exename --help`, String), header)
<endfold id='4'>end</endfold id='4'>

@test isequal(exp(complex( Inf, NaN)), complex(-Inf, NaN))
@test isequal(exp(complex( Inf, Inf)), complex(-Inf, NaN))

# Numbers
0b10
0o01_70
0x00000000000000001111_22_2233334444
-0x0002im
1.0e10
0.00025f0
-1.5_5f0
0xdeadbeefim
0x1.8p3
0x.4p-1
# Invalid number
0x000__22

chars = ['0', '1', '2', '3', 'a', 'b', 'c', 'd', 'e', 'X', 'Y', 'Z',
         '๐ €‹', '๐ €Œ', '๐ €', '๐Ÿ‚ ', '๐Ÿ‚ก', '๐Ÿ‚ข', '๐Ÿ‚ฃ', '๐Ÿ‚ฎ']

@test docstrings_equal(@doc(ModuleMacroDoc), doc"I am a module")
match(r"^\s*(?:#|$)", "# a comment")

<beginfold id='4'>abstract type</beginfold id='4'> Test2 <endfold id='4'>end</endfold id='4'>

<beginfold id='4'>function</beginfold id='4'> โˆ‡abcโˆ‡def(a::Int,
                 b:: Int,
                 c::Dict{String, Int},
                 d:: Dict{String, Vector{eltype(var1)}},
                 f::AbstractVector{<:Number},
                 g::T,
                 h::T) where {T <: Number}
    x::Int = 1
    z = collect(1:10)
    return z[3:end] .+ x .- a
<endfold id='4'>end</endfold id='4'>

<beginfold id='4'>mutable struct</beginfold id='4'> TestType <: AbstractVector{Number}
    field1::Int
    โˆ‡field2::Vector
<endfold id='4'>end</endfold id='4'>

<beginfold id='4'>struct</beginfold id='4'> ParametricType{T, V <: Tuple}
    field1
    field2::Float

    <beginfold id='4'>function</beginfold id='4'> ParametricType{T, V}(r, d) where {T, V <: Tuple}
        return new{T, V}(r, d)
    <endfold id='4'>end</endfold id='4'>
<endfold id='4'>end</endfold id='4'>