commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebbASF <...@git.apache.org>
Subject [GitHub] commons-lang pull request #231: Evaluate Architecure
Date Mon, 20 Mar 2017 10:39:46 GMT
Github user sebbASF commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/231#discussion_r106870483
  
    --- Diff: src/test/java/org/apache/commons/lang3/ArchUtilsTest.java ---
    @@ -0,0 +1,131 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.commons.lang3;
    +
    +import org.apache.commons.lang3.arch.Processor;
    +import org.apache.commons.lang3.arch.ProcessorArch;
    +import org.junit.Test;
    +
    +import static org.junit.Assert.assertTrue;
    +import static org.junit.Assert.assertFalse;
    +import static org.junit.Assert.assertNull;
    +import static org.junit.Assert.assertNotNull;
    +
    +/**
    + * Test class for {@link ArchUtils}.
    + *
    + * @author Tomschi
    + */
    +public class ArchUtilsTest {
    +
    +    // x86
    +    private static final String X86 = "x86";
    +    private static final String X86_I386 = "i386";
    +    private static final String X86_I486 = "i486";
    +    private static final String X86_I586 = "i586";
    +    private static final String X86_I686 = "i686";
    +    private static final String X86_PENTIUM = "pentium";
    +
    +    // x86_64
    +    private static final String X86_64 = "x86_64";
    +    private static final String X86_64_AMD64 = "amd64";
    +    private static final String X86_64_EM64T = "em64t";
    +    private static final String X86_64_UNIVERSAL = "universal";
    +
    +    // IA64
    +    private static final String IA64 = "ia64";
    +    private static final String IA64W = "ia64w";
    +
    +    // IA64_32
    +    private static final String IA64_32 = "ia64_32";
    +    private static final String IA64N = "ia64n";
    +
    +    // PPC
    +    private static final String PPC = "ppc";
    +    private static final String POWER = "power";
    +    private static final String POWERPC = "powerpc";
    +    private static final String POWER_PC = "power_pc";
    +    private static final String POWER_RS = "power_rs";
    +
    +    // PPC 64
    +    private static final String PPC64 = "ppc64";
    +    private static final String POWER64 = "power64";
    +    private static final String POWERPC64 = "powerpc64";
    +    private static final String POWER_PC64 = "power_pc64";
    +    private static final String POWER_RS64 = "power_rs64";
    +
    +    @Test
    +    public void testIs32BitJVM() {
    +        Processor processor = ArchUtils.getProcessor(X86);
    +        assertNotNull(processor);
    +        assertTrue(ProcessorArch.BIT_32.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(IA64_32);
    +        assertNotNull(processor);
    +        assertTrue(ProcessorArch.BIT_32.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(PPC);
    +        assertNotNull(processor);
    +        assertTrue(ProcessorArch.BIT_32.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(X86_64);
    +        assertNotNull(processor);
    +        assertFalse(ProcessorArch.BIT_32.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(PPC64);
    +        assertNotNull(processor);
    +        assertFalse(ProcessorArch.BIT_32.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(IA64);
    +        assertNotNull(processor);
    +        assertFalse(ProcessorArch.BIT_32.equals(processor.getProcessorArch()));
    +    }
    +
    +    @Test
    +    public void testIs64BitJVM() {
    +        Processor processor = ArchUtils.getProcessor(X86_64);
    +        assertNotNull(processor);
    +        assertTrue(ProcessorArch.BIT_64.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(PPC64);
    +        assertNotNull(processor);
    +        assertTrue(ProcessorArch.BIT_64.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(IA64);
    +        assertNotNull(processor);
    +        assertTrue(ProcessorArch.BIT_64.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(X86);
    +        assertNotNull(processor);
    +        assertFalse(ProcessorArch.BIT_64.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(PPC);
    +        assertNotNull(processor);
    +        assertFalse(ProcessorArch.BIT_64.equals(processor.getProcessorArch()));
    +
    +        processor = ArchUtils.getProcessor(IA64_32);
    +        assertNotNull(processor);
    +        assertFalse(ProcessorArch.BIT_64.equals(processor.getProcessorArch()));
    +    }
    +
    +    @Test
    +    public void testGetProcessor() {
    +        assertNotNull(ArchUtils.getProcessor(X86));
    +        assertNull(ArchUtils.getProcessor("NA"));
    +    }
    +
    --- End diff --
    
    There are no tests for Processor type.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message