// Path: instrumenter/src/test/java/com/offbynull/coroutines/instrumenter/testhelpers/TestUtils.java
// public static Map<String, byte[]> readZipFromResource(String path) throws IOException {
//     ClassLoader cl = ClassLoader.getSystemClassLoader();
//     URL url = cl.getResource(path);
//     Validate.isTrue(url != null);
//         
//     Map<String, byte[]> ret = new LinkedHashMap<>();
//         
//     try (InputStream is = url.openStream();
//             ZipArchiveInputStream zais = new ZipArchiveInputStream(is)) {
//         ZipArchiveEntry entry;
//         while ((entry = zais.getNextZipEntry()) != null) {
//             ret.put(entry.getName(), IOUtils.toByteArray(zais));
//         }
//     }
//         
//     return ret;
// }
// 
// Path: instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/VariableTable.java
// public final class Variable {
//     private Type type;
//     private int index;
//     private boolean used;
// 
//     private Variable(Type type, int index, boolean used) {
//         this.type = type;
//         this.index = index;
//         this.used = used;
//     }
// 
//     /**
//      * Get the type of this local variable table entry.
//      * @return type of this entry
//      * @throws IllegalArgumentException if this {@link Variable} has been released
//      */
//     public Type getType() {
//         Validate.isTrue(used);
//         return type;
//     }
// 
//     /**
//      * Get the index of this entry within the local variable table.
//      * @return index of this entry
//      * @throws IllegalArgumentException if this {@link Variable} has been released
//      */
//     public int getIndex() {
//         Validate.isTrue(used);
//         return index;
//     }
// 
//     /**
//      * Returns {@code true} if this object hasn't been released.
//      * @see VariableTable#releaseExtra(com.offbynull.coroutines.instrumenter.asm.VariableTable.Variable) 
//     
//      * @return index of this entry
//      * @throws IllegalArgumentException if this {@link Variable} has been released
//      */
//     public boolean isUsed() {
//         return used;
//     }
//         
//     private VariableTable getParent() {
//         return VariableTable.this;
//     }
// }


import static com.offbynull.coroutines.instrumenter.testhelpers.TestUtils.readZipFromResource;
import com.offbynull.coroutines.instrumenter.asm.VariableTable.Variable;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
package com.offbynull.coroutines.instrumenter.asm;


public final class VariableTableTest {
    
    private ClassNode classNode;
    private MethodNode methodNode;
    
    @BeforeEach
    public void setUp() throws IOException {
        byte[] classData = readZipFromResource("SimpleStub.zip").get("SimpleStub.class");
        
        ClassReader classReader = new ClassReader(classData);
        classNode = new ClassNode();
        classReader.accept(classNode, 0);
        
        methodNode = classNode.methods.get(1); // stub should be here
    }

    @Test
    public void mustBeAbleToAccessThisReference() {
        VariableTable fixture = new VariableTable(classNode, methodNode);
// Path: instrumenter/src/test/java/com/offbynull/coroutines/instrumenter/testhelpers/TestUtils.java
// public static Map<String, byte[]> readZipFromResource(String path) throws IOException {
//     ClassLoader cl = ClassLoader.getSystemClassLoader();
//     URL url = cl.getResource(path);
//     Validate.isTrue(url != null);
//         
//     Map<String, byte[]> ret = new LinkedHashMap<>();
//         
//     try (InputStream is = url.openStream();
//             ZipArchiveInputStream zais = new ZipArchiveInputStream(is)) {
//         ZipArchiveEntry entry;
//         while ((entry = zais.getNextZipEntry()) != null) {
//             ret.put(entry.getName(), IOUtils.toByteArray(zais));
//         }
//     }
//         
//     return ret;
// }
// 
// Path: instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/asm/VariableTable.java
// public final class Variable {
//     private Type type;
//     private int index;
//     private boolean used;
// 
//     private Variable(Type type, int index, boolean used) {
//         this.type = type;
//         this.index = index;
//         this.used = used;
//     }
// 
//     /**
//      * Get the type of this local variable table entry.
//      * @return type of this entry
//      * @throws IllegalArgumentException if this {@link Variable} has been released
//      */
//     public Type getType() {
//         Validate.isTrue(used);
//         return type;
//     }
// 
//     /**
//      * Get the index of this entry within the local variable table.
//      * @return index of this entry
//      * @throws IllegalArgumentException if this {@link Variable} has been released
//      */
//     public int getIndex() {
//         Validate.isTrue(used);
//         return index;
//     }
// 
//     /**
//      * Returns {@code true} if this object hasn't been released.
//      * @see VariableTable#releaseExtra(com.offbynull.coroutines.instrumenter.asm.VariableTable.Variable) 
//     
//      * @return index of this entry
//      * @throws IllegalArgumentException if this {@link Variable} has been released
//      */
//     public boolean isUsed() {
//         return used;
//     }
//         
//     private VariableTable getParent() {
//         return VariableTable.this;
//     }
// }


// Path: instrumenter/src/test/java/com/offbynull/coroutines/instrumenter/asm/VariableTableTest.java
import static com.offbynull.coroutines.instrumenter.testhelpers.TestUtils.readZipFromResource;
import com.offbynull.coroutines.instrumenter.asm.VariableTable.Variable;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;

package com.offbynull.coroutines.instrumenter.asm;


public final class VariableTableTest {
    
    private ClassNode classNode;
    private MethodNode methodNode;
    
    @BeforeEach
    public void setUp() throws IOException {
        byte[] classData = readZipFromResource("SimpleStub.zip").get("SimpleStub.class");
        
        ClassReader classReader = new ClassReader(classData);
        classNode = new ClassNode();
        classReader.accept(classNode, 0);
        
        methodNode = classNode.methods.get(1); // stub should be here
    }

    @Test
    public void mustBeAbleToAccessThisReference() {
        VariableTable fixture = new VariableTable(classNode, methodNode);
        Variable var = fixture.getArgument(0);