我要评分
获取效率
正确性
完整性
易理解

Running and Verification

Procedure

  1. Obtain the built-in test cases.
    cd /path/to/
    git clone https://github.com/crystal-lang/crystal.git
  2. Run Crystal using a container.
    docker run -it 84codes/crystal:latest-fedora-37
  3. View the container ID.
    docker ps -a

    If CONTAINER ID is displayed in the command output, the container is running properly.

  4. Export the container and import the test case to re-create a container.
    docker export caf67ade6d37 > crystal.tar
    mkdir crystal-example
    tar xf crystal.tar -C crystal-example
    rm -rf crystal.tar
    cp -r crystal/samples/* crystal-example/home
    cd crystal-example
    tar cf crystal.tar *
  5. Import the container.
    docker import - crystal:example < crystal.tar
    docker images

    If the following information is displayed, the import is successful.

  6. Use Crystal to run the binary-trees.cr, red_black_tree.cr, and pig.cr test cases.
    docker run -it crystal:example /usr/bin/crystal run /home/binary-trees.cr

    If the following information is displayed, the running is successful.

    docker run -it crystal:example /usr/bin/crystal run /home/red_black_tree.cr

    If the following information is displayed, the running is successful.

    docker run -it crystal:example /usr/bin/crystal run /home/pig.cr

    If the following information is displayed, the running is successful.